Radio button in CakePHP 1.1/1.2/1.3
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.






I am
about 1 year ago
If you change the default value it will not work… Use Male
about 1 year ago
If you change the default value it will not work… Use Male
about 1 year ago
@Juan, Its working for me if i change the default value.
about 1 year ago
@Juan, Its working for me if i change the default value.
about 1 year ago
Hi,
Thanks.
I want on change event on radio button.How i can define it with cakephp?
Please reply if you know. Its Urgent.
about 1 year ago
Hi,
Thanks.
I want on change event on radio button.How i can define it with cakephp?
Please reply if you know. Its Urgent.
about 1 year ago
You can define it in attributes array.
about 1 year ago
You can define it in attributes array.
about 1 year ago
The problemas was tih firefox with refresh
about 1 year ago
The problemas was tih firefox with refresh
about 1 year ago
Does any one know how to create a .pdf file on the fly using php?
about 1 year ago
I posted this message “Does any one know how to create a .pdf file on the fly using php?” 4 days ago and no one replied to it! Does that means no one really know how to do it?
about 1 year ago
Hi…Its a very useful content,..I like it so much…
Kinjal Solanki
MIS Co-Ordinator
kinjal.mis@gmail.com
District Watershed Development Unit
http://www.dwdupatan.com
Patan-384265
Gujarat(India)