Hello Friends,

Are you facing a problem in radio button when you are working woth CakePHP 1.3 ? Today i was working with Radio button in CakePHP 1.3 and i face some difficulty in showing radio button, remove hidden option and show selected radio button.I found little syntax change in CakePHP 1.3. Here i am showing you how to show radio button with CakePHP 1.3.

$options=array('Female'=>'Female','Male'=>'Male');
$attributes = array('legend'=>false,'value'=>'Female');
echo $form->radio('gender',$options,$attributes);

 

By default, Radio elements are wrapped with a label and fieldset. If you want to remove this than set legend attribute to false. Now if by default radio button will generate hidden element automatically. If you don't want that hidden element than show any of the radio button selected. You can make the radio button selected by giving the element value in value attribute. Look at above code. If you find any problem in this than let me know by comment.

rax rss Radio button in CakePHP 1.1/1.2/1.3  rax twitter Radio button in CakePHP 1.1/1.2/1.3  rax facebook Radio button in CakePHP 1.1/1.2/1.3  rax myspace Radio button in CakePHP 1.1/1.2/1.3