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?

有帮助吗?

解决方案

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'];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top