The default decorator for the Zend_Form_Element_Radio is
<label for="type_id-1"><input type="radio" name="type_id" id="type_id-1" value="1">Pack</label>
The label
tag wraps the input
tag. Instead I would like to to look like
<input type="radio" name="type_id" id="type_id-1" value="1"><label for="type_id-1">Pack</label>
I thought it might have to do with the "Label" of the element, but that is different. Even with the following code, I still get the label wrapping the radio. When I use this form code.
public function init()
{
parent::init();
$this->setName('createdomain');
$type_id = new Zend_Form_Element_Radio('type_id');
$type_id->setLabel('Please Choose')
->setRequired()
->setMultiOptions(array('m' => "male", 'f' => 'female'));
$this->addElement($type_id);
$this->setElementDecorators(array(
'ViewHelper',
array('Label',array('placement' => 'APPEND')),
));
}
I get this HTML as a result
<form id="createdomain" enctype="application/x-www-form-urlencoded" action="" method="post"><dl class="zend_form">
<label for="type_id-m"><input type="radio" name="type_id" id="type_id-m" value="m">male</label><br />
<label for="type_id-f"><input type="radio" name="type_id" id="type_id-f" value="f">female</label>
<label for="type_id" class="required">Please Choose</label></dl>
</form>
Notice how there is a label
tag wrapping the input
tag?