How can I say to Yii to check a radiobutton for default when the radiobutton list is rendered?
For activeDropDownList it’s easy, but I don’t see how to do it with radio button in the documentation.
How can I say to Yii to check a radiobutton for default when the radiobutton list is rendered?
For activeDropDownList it’s easy, but I don’t see how to do it with radio button in the documentation.
use the activeRadioButton() it’s should check it automatically
<?php echo activeRadioButton($post, 'active'); ?>
where $post is the model and ‘active’ your attribute (database field)
Uhm no I’ve to specify which is the default value. Is there a way?
Couse the default value is in a attribute of another model.
I’ve
$user->priority that use a activeRadioButtonList and the default value of activeRadioButtonList is in $user->config->priority
Up please How can I check an item for default using Yii?
If I understand your problem correctly:
Did you try
$user-setAttribute('priority', $user->config->priority)
before rendering the view?
Assuming $user->config refers to the same model instance.
(not tested)
/Tommy