views:

50

answers:

2

Hi I'm using formRadio() to display two options with radio buttons. Example

<li><?php echo $this->formRadio('johnsmith', '1', array(), array('1' => 'Yes', '0' => 'No'), ' '); ?></li>

Getting HTML output

<li>
   <label for="johnsmith-1">
     <input type="radio" name="johnsmith" id="johnsmith-1" value="1" checked="checked">
   Yes
   </label>
</li>
<li>
  <label for="johnsmith-0">
    <input type="radio" name="johnsmith" id="johnsmith-0" value="0">
   No
   </label>
</li>

but im looking HTML like

<li>
   <input type="radio" name="johnsmith" id="johnsmith-1" value="1" checked="checked">
   <label for="johnsmith-1">Yes</label>
<li>
<li>
  <input type="radio" name="johnsmith" id="johnsmith-0" value="0">
  <label for="johnsmith-0">No</label>
</li>

Can anybody help me please ?

A: 

You will need to create your own Element and Decorator for this.

The view helper formRadio() will display a default rendering for the buttons.

jakenoble
Thanks, could you provide some example please ?
Gugu
see @takeshin's answer
jakenoble
A: 

For all questions regarding Zend Form markup I recommend to see first:

Leveraging Zend_Form Decorators

After watching this presentation, you will be able to create any markup for any element.

takeshin