
Thanks Ronnie, for the example! It looks like this useful hint won’t appear in the cakephp documentation any time soon. I think is’t “nerdnoteworthy”:
echo $html->radio(
'User/admin',
array(
'no' => 'No',
'yes' => 'Yes'),
null,
array('value' => 'no')
);
thank u
Wow, way to use an example months old from an almost year old ticket posted for a version of cake that is out of date and no longer intended for use.
A 1.2 example is:
echo $form->input( 'User.admin',
'type' => 'radio',
'options' => array( 'Yes'=>'yes', 'No'=>'no' )
));
Er, Abba, did you check the date on this post. No. You didn’t. Did you.
I think he didn’t. Did he?
No he didn’t. Did he?
I don’t know. Did he?
He didn’t. Did I?
u guys are funny…and yes, he didn’t check the date. so do I, did you ?
I did, did anyone else?
WTF!!
you don’t have anything to do?. do you?
I don’t have do I?
No you don’t. do you?
Wow, way to use an example years old from an almost three year old ticket posted for a version of cake that is out of date and no longer intended for use.
A 1.3 example is:
echo $this->Form->radio( ‘User.admin’, array( ‘Yes’=>’yes’, ‘No’=>’no’ ));
(In all seriousness this blog was the top result for “cakephp radio” so I figured it should have the latest answer)
If you want to set the default value in radio button in cakePHP 1.3
You can use the pattern:
radio(‘Model.field’, array(‘option1′=>’option1′, ‘option2′=>’option2′), array(‘default’=>’option2′, ‘legend’=>false)); ?>
reference site:
http://www.lost-in-code.com/programming/php-code/cakephp-form-radio-default-checked-value/
thanks Abba bryant
Look at Abba Bryant, the cake radio input god. You search google for things you already know how to do.