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

后端 未结 7 553
夕颜
夕颜 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条回答
  •  鱼传尺愫
    2021-02-04 03:14

    Zend has a form note view helper (Zend_View_Helper_FormNote), which you can use to add text.

    Just create a new form element (/application/forms/Element/Note.php):

    class Application_Form_Element_Note extends Zend_Form_Element_Xhtml  
    {  
        public $helper = 'formNote';  
    }
    

    In your form:

    $note = new Application_Form_Element_Note(
        'test',
        array('value' => 'This is a test')
    );
    $this->addElement($note);
    

提交回复
热议问题