I have a problem in updating my model values, one of the model attributes is a number that is selected from a dropDownList, here is my code:
<?php $images = Homepage::model()->findAll();
if(!empty($images)){
$data = array();
$x = 1;
foreach ($images as $i){
array_push($data, $x);
$x++;
}
?>
<?php echo $form->labelEx($model,'order'); ?>
<?php echo $form->dropDownList($model, 'order', $data, array(
'empty'=>'Select image order',
'id'=>'order')); ?>
this dropDownList is containing the number of records of model (table) in the db, the problem is in the update function, for example: on the creation of (image 1) I selected 1 as the order value, then when I go to the update, I got the pre-selected option is 2 (which is the last value of the listData) instead of 1, so what is the error here ?