Issues

ZF-5867: Decorator "options" array details

Issue Type: Docs: Improvement Created: 2009-02-23T12:32:02.000+0000 Last Updated: 2012-08-01T10:54:19.000+0000 Status: Open Fix version(s): Reporter: Atul Shrivastava (atulshr) Assignee: Frank Br├╝ckner (frosch) Tags: - Zend_Form

Related issues: - ZF-9168

Attachments:

Description

The documentation for Zend_form decorators is lacking with enough options. Actually the options array needs to be described in detail so that one can try out different variations. For example: I am trying to make a three column table (inside a zend_form) with the first being "label", second one being "form field" (e.g text-box, check-box, radio-button, dropdown) and third one being "description" but not able to get the correct HTML generated using the following decorator:

<pre class="highlight">
        $this->setElementDecorators(array(
            array('ViewHelper'),
            array('Errors'),
            array('Description', array('tag' => 'td')),
            array('HtmlTag', array('tag' => 'td')),
            array('Label', array('tag' => 'td')),
            array(array('row' => 'HtmlTag'),array('tag' => 'tr'))
        ));

which gives me the following HTML:

<pre class="highlight">
NameUnique identifier used to label a Name

You can very well see the two "" tags together which is causing problem.

Also if I use the Dojo widgets (e.g. ValidationTextBox), the moment, I enable the decorators on the form, the "promptMessage" and "invalidMessage" stops being displayed. Wondering whether it had to do something with the decorators or not !!!

Comments

Posted by twk (twk) on 2009-08-22T07:43:38.000+0000

The order is important. I think you can get the expected HTML with the following.

<pre class="highlight"> 
$this->setElementDecorators(array(
  array('ViewHelper'),
  array('Errors'),
  array('HtmlTag', array('tag' => 'td')),
  array('Description', array('tag' => 'td')),
  array('Label', array('tag' => 'td')),
  array(array('row' => 'HtmlTag'),array('tag' => 'tr'))
));

I agree with you that the documentation is poor. For example the doc should explain how to set the attributes 'options' => array('style' => 'color:red;') and how to call $formErrors->setElementStart.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts