zend form for multicheckbox remove input from labels

前端 未结 4 1088
一整个雨季
一整个雨季 2021-01-06 17:40

I am using zend_form (part of Zend Framwork) to create a form and found when I add a set of checkboxes using Zend_Form\'s multicheckbox element (Zend_Form_Element_MultiCheck

4条回答
  •  半阙折子戏
    2021-01-06 18:24

    The decorator Zend_Form_Decorator_ViewHelper is by default using the view helper Zend_View_Helper_FormMultiCheckbox to render your multicheckbox element. That view helper is extended from Zend_View_Helper_FormRadio which for some reason is hard-coded to put tags around the tag.

    You'll need to write your own view helper that copies most of the code from Zend_View_Helper_FormRadio::formRadio() but writes the HTML without tags around the element. Here's a snippet from another answer that shows the modification you might want to make.

    Your custom helper should be named Some_Prefix_Helper_FormMultiCheckbox but without knowing how your app is structured it's hard to say exactly what that Some_Prefix should be or how you would make sure to load it instead of Zend_View_Helper_FormMultiCheckbox. Check out the documentation on loading plugins for some tips.

提交回复
热议问题