Comportamento Anomalo DropdownList

Salve ragazzi,

mi chiedevo come mai la dropdownlist non selezioni il valore assegnato nella pagina di update, mostrandomi ogni volta il primo elemento della lista?

Vi posto il codice:

echo $form->labelEx($model,'type');

$typeStatus=array('PRIN'=>'PRIN','FIRB'=>'FIRB','FISR'=>'FISR','PON/POR'=>'PON/POR','MUR'=>'MUR','UE'=>'UE','ATN'=>'ATN','PUBB'=>'PUBB','PRIV'=>'PRIV' );

echo $form->dropDownList($model,'type',$typeStatus, array('prompt'=>'Select Project Type'));

echo $form->error($model,'type');

C’è un modo per cui questo non accada?grazie

how is defined your rules() in your model ?, maybe the "type" attribute is not declared as "safe" or "required", then it not will be passed to your form at all.

1-show me your rules() for your model.

2-put this line at the top of your sample code, and show me what is shown on output :

echo "<p>current list data type attribute is: [".$model->type."]</p>";

echo $form->dropDownList($model,'type',$typeStatus, array('prompt'=>'Select Project Type'));

3-as extra debug, when your view is rendered then copy and paste here the HTML SOURCE CODE generated by your browser, to see what is happen on final select tag generated

I only added this at my rules:


and now it works!

Thanks for your help! I really appreciated it.

nice !