I have an application that pulls data from tables to populate pull down fields. When the application writes the data to the primary table it uses the index to the pull down value and not the actually value. I want the application to write the value from the pull down window and not the index value to the field.
Can someone point me to where yii writes out the values that I can modify?
Page 1 of 1
changeing the value write to mysql table from GUI will pull downs.
#2
Posted 16 October 2009 - 10:18 PM
Not sure how you are building your drop down, it should be something like this:
So really, there is no need to change anything if you populate the pull down how you want.
<?php echo CHtml::activeDropDownList($model, 'my_select_var', CHtml::listData(Myclass::model()->findAll(),'my_value','my_value'), array('prompt'=>'Please Select')); ?>
So really, there is no need to change anything if you populate the pull down how you want.
#3
Posted 19 October 2009 - 10:30 AM
Thanks for the reply. I will try and incorporate this approch.
What I current have is
<?php echo CHtml::activeLabelEx($model,'cpeType_id'); ?>
<?php echo CHtml::activeDropDownList($model,'cpeType_id',CHtml::listData(CActiveRecord::model('CpeType')->findAll(),'id','model')); ?>
</div>
this is pulling 2 values('id','model') from an sql table "CpeType" and populating the pulldown with the values for 'model'
when I do a submit from the from, the form inserts the value for 'id' in the database record and not the value of model. I would prefer that the submit uses the value form the pulldown for the model and not the 'id' value.
What I current have is
<?php echo CHtml::activeLabelEx($model,'cpeType_id'); ?>
<?php echo CHtml::activeDropDownList($model,'cpeType_id',CHtml::listData(CActiveRecord::model('CpeType')->findAll(),'id','model')); ?>
</div>
this is pulling 2 values('id','model') from an sql table "CpeType" and populating the pulldown with the values for 'model'
when I do a submit from the from, the form inserts the value for 'id' in the database record and not the value of model. I would prefer that the submit uses the value form the pulldown for the model and not the 'id' value.
Share this topic:
Page 1 of 1

Help













