Possible to add javascript to Zend_Form_Element_Radio?
- by Stepppo
Ultimately, I'd like my Zend Form to render this HTML:
<p>Do you have any documents to upload?</p>
<p>Yes <input type="radio" value="Yes" name="uploadChoice" onClick="showTable()"> No <input type="radio" value="No" name="uploadChoice" onClick="hideTable()" checked></p>
Here's what I have in my Zend_Form:
//create radio buttons
$uploadQuestion = new Zend_Form_Element_Radio('upLoadQuestion');
$uploadQuestion->setLabel('Do you have any documents to upload?')
->addMultiOptions(array(
'yes' => 'Yes',
'no' => 'No'
))
->setSeparator(' ');
The problem I'm running into is how to add the onClick="showTable()" and onClick="hideTable()" elements to their respective radio buttons.
In the alternative, I could rework the javascript and add something like onClick="toggleTable()" to the radio buttons if I can't add something different to each of the radio buttons. But, will Zend let me do that?