Zend Form: Checkbox element displays as hidden field?

后端 未结 6 1851
春和景丽
春和景丽 2021-02-20 08:34

I would like to add a simple check box to my form:

$element = new Zend_Form_Element_Checkbox(\'dont\');
$element->setDescription(\'Check this box if you don\\\         


        
6条回答
  •  孤城傲影
    2021-02-20 09:14

    To change the way a form element is rendered, you can use the decorators, which can be modified with

    // Overwrite existing decorators with this single one:
    $element->setDecorators(array('Composite'));
    

    For a list of all the default decorators, you look at standard decorators; for a list of the decorators used by the form fields, you can see standard form elements.

    It seems to me that the hidden form elements is added from Zend with a precise purpose, and removing it (if that is even possible) could cause some problems. My first thought is that Zend uses that hidden form to check if the value has been changed, or to verify if the from has been really generated from Zend (this hypothesis seems less plausible).

提交回复
热议问题