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.
Page 1 of 1
CHtml::activeRadioButtonList and default radio checked
#2
Posted 09 November 2009 - 05:44 AM
use the activeRadioButton() it's should check it automatically
where $post is the model and 'active' your attribute (database field)
<?php echo activeRadioButton($post, 'active'); ?>
where $post is the model and 'active' your attribute (database field)
#3
Posted 09 November 2009 - 06:03 AM
bas_vdl, on 09 November 2009 - 05:44 AM, said:
use the activeRadioButton() it's should check it automatically
where $post is the model and 'active' your attribute (database field)
<?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
#5
Posted 16 November 2009 - 12:01 PM
StErMi, on 16 November 2009 - 11:35 AM, said:
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
Share this topic:
Page 1 of 1

Help













