what is the proper xml syntax for defining <multicheckbox> form element in zend form
I'm creating Zend_Form using Xml config which defines two element select and multicheckbox. I have found this link which has answered one my of question however I cannot find any example of multicheckbox element syntax.
any help is appreciated.
here is what i have done so far (for fun)
<?xml version="1.0" encoding="UTF-8"?>
<form>
<localhost>
<formmanager>
<pizza>
<action>/form/</action>
<method>post</method>
<name>Pizza</name>
<el开发者_JAVA百科ements>
<crust>
<type>Select</type>
<name>crust</name>
<options>
<label>Crust:</label>
<required>true</required>
<multioptions>
<option value="Thin crust">Thin crust</option>
<option value="Thick crust">Thick crust</option>
</multioptions>
</options>
</crust>
<pan>
<type>MultiCheckbox</type>
<required>true</required>
<options>
<label>Pan:</label>
<multioptions>
<option>American Hot</option>
<option>Cheese and tomato</option>
</multioptions>
</options>
</pan>
</elements>
</pizza>
</formmanager>
</localhost>
</form>
Solution: After a long time, looking through Zend_Config, Zend_Config_Xml, Zend_Form_Element_MultiChoiceBox and Zend_Form_Element_Multi class, I figured it out and here it is
<?xml version="1.0" encoding="UTF-8"?>
<form>
<localhost>
<formmanager>
<pizza>
<action>/form/</action>
<method>post</method>
<name>Pizza</name>
<elements>
<crust>
<type>Select</type>
<name>crust</name>
<options>
<label>Crust:</label>
<required>true</required>
<multioptions>
<thin_crust>Thin Crust</thin_crust>
<thick_crust>Thick Crust</thick_crust>
</multioptions>
<value>test</value>
</options>
</crust>
<pan>
<type>MultiCheckbox</type>
<name>pan</name>
<options>
<label>Pan:</label>
<multioptions>
<american>American Hot</american>
<cheese>Cheese and Tomato</cheese>
</multioptions>
<required>true</required>
</options>
</pan>
</elements>
</pizza>
</formmanager>
</localhost>
</form>
精彩评论