problen in dropdown

why when I use this line ->>>> echo $form->dropDownList($model,‘Province’, $serv4,

the code for dependent dropdownlist not work but when I use the following it’s work

->>>>>> echo CHtml::dropDownList(‘S_id’,’’, $serv4, but this can’t store in database .Why? only echo $form->drop… can store the item in data base

it’s not store to database

array(

‘ajax’ => array(

‘type’=>‘POST’,

‘url’=>CController::createUrl(‘FullTable/dynamiccities’),

‘update’=>’#prov_id’,

)));

does your model has ‘Province’ attribute (foreign key) or is it rather relation name?

according to API docs - this function takes:




CActiveFrom::dropDownList(CModel $model, string $attribute, array $data, array $htmlOptions)



where the other:




CHtml::dropDownList(string $name, string $select, array $data, array $htmlOptions)



NOTE: moved to proper sub-forum

Check your generated dropdown id, if it is same in both cases(when you are using CActiveForm and model, it ads prefix {ModelName} to id of form element name, so you might need to modify update field id in ajax function).