Question

Im using Chtml for one of my form in my Yii project.

I have implemented radioButton in that form , i.e

   <?php echo CHtml::radioButtonList('asset', 'asset', $listAsset, array('uncheckValue'=>null));?>

how can I do validation for this?

Was it helpful?

Solution

we don't want use model name in form mean try the following steps

after assign the attribute values you can assign the post values to model attributes

once you specified the validation in MODEL's rules function, you can use the following steps.

example :

$model->attributes = $_POST['model']; //if you use model name in other fields  

$model->asset = $_POST['asset'];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top