Zend Framework: Insert DIV and Image in my form

前端 未结 8 1826
伪装坚强ぢ
伪装坚强ぢ 2020-12-19 22:30

I need to insert html code like this in my zend form:

8条回答
  •  有刺的猬
    2020-12-19 22:49

    This is quasi-finished in ZF 1.10. Seems someone made a Zend_View_Helper_FormNote class so you can insert arbitrary (cept for the decorator) HTML.

    To use it you must extend Zend_Form_Element_Xhtml.

    Then using the form plugin loader, add your form/element classes to the form object. I put it in my library folder (MyNs/Form/Element/Note.php).

     $yourForm= new Zend_Dojo_Form();
     $yourForm->addPrefixPath("MyNS_Form", "MyNS/Form/");
    

    Now you can call it just like any element.

     $yourForm->addElement(
                    'note',
                    'myElementId',
                    array(
                     'value'=>'omgwtfbbq'
                    )
                )
    

    As I mentioned before this still wraps your code in the decorator, but its a solution pre-built into ZF.

提交回复
热议问题