Zend Framework: How do I remove the decorators on a Zend Form Hidden Element?

后端 未结 11 1745
说谎
说谎 2020-12-23 00:07

I\'m trying to remove the default decorators on a hidden form element. By default, the hidden element is displayed like this:

Hidden Element Label
11条回答
  •  长情又很酷
    2020-12-23 00:34

    I couldn't get disableLoadDefaultDecorators to work quite right. Here's a solution I came up with.

    $hiddenIdField = new Zend_Form_Element_Hidden('id');
    $hiddenIdField->setValue($portalId)
                  ->removeDecorator('label')
                  ->removeDecorator('HtmlTag'); 
    

    In the HTML, the hidden field appears without any extra tags around it.

    ...
    
    ...

提交回复
热议问题