htmlyiiradio-buttonyii-booster

how to use the “required” attribute in Yii booster radioButtonListRow


Does Anyone know how to use the "required" attribute in Yii booster radioButtonListRow for client side validation only?

echo $form->radioButtonListRow($model, 'radioButtons', array(
        'Option one',
        'Option two',
    ));

Solution

  • This has nothing to do with yiibooster. Yii deals with it. In your model you can mention rules like which attribute is required

    array('your attribute', 'required'),
    

    and you can use this as

    echo $form->radioButtonListRow($model, 'your attribute', array(
           '0'=> 'Option one',
            '1'=>'Option two',
        ));
    

    Yii will automatically validate the attribute you have mentioned