How does one add a 'plain text node' to a zend form?

后端 未结 7 638
夕颜
夕颜 2021-02-04 02:41

I\'m trying to add a plain text node in a zend form - the purpose is to only dispay some static text.

The problem is - im not aware of any such way to do it.

I

7条回答
  •  Happy的楠姐
    2021-02-04 03:24

    Adding a hidden element with non-escaped description does the thing.

    $form->addElement('hidden', 'plaintext', array(
        'description' => 'Hello world! Check it out',
        'ignore' => true,
        'decorators' => array(
            array('Description', array('escape'=>false, 'tag'=>'')),
        ),
    ));
    

    Works perfectly. It is still attached to an element, which is, however, not rendered this way.

    Code taken from: http://paveldubinin.com/2011/04/7-quick-tips-on-zend-form/

提交回复
热议问题