Problem dependent Dropdownlist

I am tring to generate a code for dependent dropdownlist

I created successfully but when i try to save data i say city filed can not be blank

When i tried to resolve the problem useing fire bug

I seen that the city_id is coming without model name

<select id="city" name="city"> this is coming in fire bug

i think it should be Islands_city

If i do it manually code is work perfect

dropdown list code is echo CHtml ::dropDownList(‘city’, ‘’,$ldata, array(‘prompt’=>’–Select Skill Specialty–’));?>

If i do it as echo CHtml ::dropDownList($model,‘city’, ‘’,$ldata, array(‘prompt’=>’–Select Skill Specialty–’));?>

i got error Object of class Islands could not be converted to string

return str_replace(array(’[]’,’][’,’[’,’]’,’ ‘),array(’’,’’,’’,’’,’_’),$name);

Following is my _form.php

<?php echo $form->labelEx($model, ‘country’); ?>


						       &#036;models = islands::model()-&gt;findAll();

							  &#036;list = CHtml::listData(&#036;models, 

            'country', 'country');



							  echo CHtml::activeDropDownList(&#036;model, 'country', &#036;list, array(

                                'ajax' =&gt; array(

‘type’=>‘POST’, //request type

‘url’=>CController::createUrl(‘islands/dynamiccities1’), //url to call.

//Style: CController::createUrl(‘currentController/methodToCall’)

//‘data’=>array(‘country’=>‘js:this.value’ ),

‘update’=>’#city’, //selector to update

//‘update’ =>’#’.CHtml::activeId($model,‘City’)

//‘data’=>array(‘country’=>‘js:this.value’ ),

//leave out the data key to pass all form values through

//‘data’ => array(‘category’, ‘js:this.value’),

))); ?>

<div id="nameerror"


                            &lt;?php echo &#036;form-&gt;error(&#036;model, 'country'); ?&gt;




<div class="row">

            &lt;?php echo &#036;form-&gt;labelEx(&#036;model,'city'); 

         echo CHtml ::dropDownList('city', &quot;&quot;, array(),array('prompt'=&gt;'--Select Skill Specialty--'));

			//echo CHtml ::dropDownList(model,'city', &quot;&quot;, array(),array('prompt'=&gt;'--Select Skill Specialty--'));

			//echo &#036;form-&gt;dropDownList(&#036;model,'city','',array(),array('prompt'=&gt;'Select'));


And following is my controller file

public function actionDynamiccities1()



//echo &#036;test;

 &#036;data=islands::model()-&gt;findAllbysql('select * from islands WHERE country=:country', array(':country'=&gt;&#036;test));


              array(':ID'=&gt; (int)&#036;_POST['ID']));*/


foreach(&#036;data as &#036;value=&gt;&#036;city)


    echo CHtml::tag('option',




Can you please use "code" tags to format your code?

[color="#006400"]/* Moved from "Tips" to "1.1 General Discussion" */[/color]

Please format your post with "code" tags to make it readable, otherwise no one is able to understand your issue.