i am trying to create a Radio button using Cakephp like the one the result should resemble like
<div data-attr="radio" id="1"> <label id="label1">Untitled1</label><br/> <input type="radio" value="option1" id="Radio11" name="Workexperience"/> <label for="Radio11">Option1</label> <input type="radio" value="option2" id="Radio12" name="Workexperience"/> <label for="Radio12">Option2</label> </div>
how to generate so using Form helper.. Please suggest me..
This might help,
http://book.cakephp.org/view/189/Automagic-Form-Elements#options-before-options-between-options-separator-a-191
For radio type input the 'separator' attribute can be used to inject markup to separate each input/label pair.
Code View
<?php echo $form->input('field', array( 'before' => '--before--', 'after' => '--after--', 'between' => '--between---', 'separator' => '--separator--', 'options' => array('1', '2'), 'type' => 'radio' ));?>
Output:
<div class="input"> --before-- <input name="data[User][field]" type="radio" value="1" id="UserField1" /> <label for="UserField1">1</label> --separator-- <input name="data[User][field]" type="radio" value="2" id="UserField2" /> <label for="UserField2">2</label> --between--- --after-- </div>
Looks like $form->radio() should do what you need. I don't know if it will look exactly like your example.