Zend Form: Checkbox element displays as hidden field?

后端 未结 6 1793
春和景丽
春和景丽 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

    Andrew, here's how to really hide your hidden form elements:

    $element1 = $form->createElement('hidden', 'element1');
    $element1
      ->setDecorators(array(
        'ViewHelper',
        array('HtmlTag', array('tag' => 'dd'))
      ));
    

    Now, you don't have to mess with jQuery code to try to shrink those down. And, you don't have to worry about hidden checkbox fields, either.

提交回复
热议问题