Note that there are some explanatory texts on larger screens.

plurals
  1. POZend_Form: How to add custom HTML
    primarykey
    data
    text
    <p>I 'am bussy creating a form with zend_form to add a page to a website. This form is for a CMS.</p> <p>This is the code:</p> <pre><code>public function init() { // display errors on top $this-&gt;setDecorators(array( array('FormErrors', array('markupElementLabelEnd' =&gt;'', 'markupElementLabelStart' =&gt;'')), 'FormElements', array('HtmlTag', array('tag' =&gt; 'dl', 'class' =&gt; 'zend_form')), 'Form' )); // Set standard properties $this-&gt;setName('Admin_Form_Addpage') -&gt;setAction(""); // Textbox for the page title. The textbox is required $title = new Zend_Form_Element_Text('title'); $title-&gt;setLabel('Title') -&gt;setAttrib('placeholder', 'Title') -&gt;setAttrib('autofocus', "") -&gt;setRequired(); // WYSIWYG editor $wysiwyg = new Zend_Form_Element_Textarea('pagecontent'); $wysiwyg-&gt;setLabel('Content') -&gt;setRequired(); // Advanced CSS $css = new Zend_Form_Element_Textarea('css'); $css-&gt;setLabel('CSS') -&gt;setAttrib('rows', 10) -&gt;setAttrib('cols', 60); // Advanced JS $js = new Zend_Form_Element_Textarea('js'); $js-&gt;setLabel('Java Script') -&gt;setAttrib('rows', 10) -&gt;setAttrib('cols', 60); // Build form $this-&gt;addElement($title) -&gt;addElement($wysiwyg) // Add submit button -&gt;addElement('submit', 'add', array('label' =&gt; 'Add')) -&gt;addElement($css) -&gt;addElement($js) -&gt;addDisplayGroup(array('css','js'), 'advanced',array('disableLoadDefaultDecorators' =&gt; true)); $advanced = $this-&gt;getDisplayGroup('advanced'); $advanced-&gt;setDecorators(array( 'FormElements', array('HtmlTag', array('tag' =&gt; 'div', 'id' =&gt; 'div_advanced')) )); /** * Remove Errors decorator from all elements * so that they don't also display them */ foreach ($this-&gt;getElements() as $element) { $element-&gt;removeDecorator('Errors'); } </code></pre> <p>Now I want to toggle the advanced component with jQuery. But to for this to work I need a link.</p> <p>So my question is, is there some one that knows how to do that? Or even better has some one a custom form element that can add all types of html?</p> <p>Thank you,</p> <p>Ivo Trompert</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload