Yii Framework Forum: Get Property Category Dropdwon List - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Get Property Category Dropdwon List

#1 User is offline   Khandad Niazi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 15-October 12

Posted 10 January 2013 - 02:05 PM

Hi
All i am new in yii and need some help

i wrote a function

public function getCateygoryList()
{
$c= new CDbCriteria;
$c->select = 'catId, catName';
$c->from = 'af_categories';
$c->order = 'catName ASC';
$category = Categories::model()->findAllByPk($c);
return $category;
}

in category model when i call this function to property form to create category dropdown list like

<div class="row">
<?php echo $form->labelEx($model,'fkcategroyid'); ?>
<?php /*?><?php echo $form->textField($model,'fkcategroyid'); ?><?php */?>
<?php echo $form->dropDownList($model,'fkcategroyid', $model->categories->getCateygoryList()); ?>
<?php echo $form->error($model,'fkcategroyid'); ?>
</div>

it show error

Property "Tblproperty.categories" is not defined.


Thanks in advance.
0

#2 User is offline   chandran 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 494
  • Joined: 08-October 12
  • Location:Austria

Posted 19 May 2014 - 03:17 AM

you should use


$model->getCateygoryList()


NOT


$model->categories->getCateygoryList()
Thanks
chandran nepolean

My own extension:
http://www.yiiframew...sion/ejqueryte/

My wiki
http://www.yiiframew...checkboxcolumn/

If it work dont hesitate to click +1 button
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users