« Return to Thread: Using Zend_Form::setElementDecorators() with Zend_Config_Xml

Re: Using Zend_Form::setElementDecorators() with Zend_Config_Xml

by Ralf Eggert :: Rate this Message:

Reply to Author | View in Thread

Hi Matthew,

>> If I try it, I get an fatal error:
>>
>>   Fatal error: Call to a member function getOrder() on a non-object in
>>   /home/devhost/phpmagazin/form/library/Zend/Form.php on line 824
>
> Hmmm... Can you send some reproduce code for this?

I attached an XML file to this mail. I got the error with 1.5.1 release
but I bet it is due to the incorrect XML file with two <elements> Sections.

> This is an interesting idea. Could you put a request in the issue
> tracker for this? It would be fairly trivial to implement, and would
> solve a number of the issues people have reported regarding the usage of
> setElementDecorators().

Ok, done: http://framework.zend.com/issues/browse/ZF-3228

Thanks and best regards,

Ralf


<?xml version="1.0" encoding="UTF-8"?>
<config>
        <contactform3>
                <action>index/send3</action>
                <method>post</method>
                <elements>
                        <name>
                                <type>text</type>
                                <options>
                                        <size>40</size>
                                        <maxlength>40</maxlength>
                                        <label>Name</label>
                                        <required>true</required>
                                        <validators>
                                                <alpha>
                                                        <validator>Alpha</validator>
                                                </alpha>
                                                <stringlength>
                                                        <validator>StringLength</validator>
                                                        <options>
                                                                <min>1</min>
                                                                <max>40</max>
                                                        </options>
                                                </stringlength>
                                        </validators>
                                </options>
                        </name>
                        <email>
                                <type>text</type>
                                <options>
                                        <size>40</size>
                                        <label>E-Mail</label>
                                        <required>true</required>
                                        <validators>
                                                <emailaddress>
                                                        <validator>EmailAddress</validator>
                                                </emailaddress>
                                                <stringlength>
                                                        <validator>StringLength</validator>
                                                        <options>
                                                                <min>6</min>
                                                        </options>
                                                </stringlength>
                                        </validators>
                                </options>
                        </email>
                        <message>
                                <type>textarea</type>
                                <options>
                                        <rows>6</rows>
                                        <cols>40</cols>
                                        <label>Nachricht</label>
                                        <required>true</required>
                                        <filters>
                                                <striptags>
                                                        <validator>StripTags</validator>
                                                </striptags>
                                        </filters>
                                </options>
                        </message>
                </elements>
                <elementDecorators>
                        <viewhelper>
                                <decorator>ViewHelper</decorator>
                        </viewhelper>
                        <errors>
                                <decorator>Errors</decorator>
                        </errors>
                        <data>
                                <decorator>
                                        <data>HtmlTag</data>
                                </decorator>
                                <options>
                                        <tag>div</tag>
                                        <class>element</class>
                                </options>
                        </data>
                        <label>
                                <decorator>Label</decorator>
                                <options>
                                        <class>left</class>
                                </options>
                        </label>
                        <row>
                                <decorator>
                                        <row>HtmlTag</row>
                                </decorator>
                                <options>
                                        <tag>div</tag>
                                        <class>row</class>
                                </options>
                        </row>
                </elementDecorators>
                <elements>
                        <country>
                                <type>select</type>
                                <options>
                                        <size>1</size>
                                        <label>Land</label>
                                        <required>true</required>
                                        <multiOptions>
                                                <_>Bitte auswählen</_>
                                                <de>Deutschland</de>
                                                <at>Österreich</at>
                                                <ch>Schweiz</ch>
                                                <xx>anders</xx>
                                        </multiOptions>
                                </options>
                        </country>
                        <newsletter>
                                <type>checkbox</type>
                                <options>
                                        <label>Newsletter?</label>
                                        <checkedValue>yes</checkedValue>
                                        <uncheckedValue>no</uncheckedValue>
                                        <description>Ja, ich will ihn haben den Newsletter!</description>
                                        <decorators>
                                                <viewhelper>
                                                        <decorator>ViewHelper</decorator>
                                                </viewhelper>
                                                <errors>
                                                        <decorator>Errors</decorator>
                                                </errors>
                                                <data>
                                                        <decorator>
                                                                <data>HtmlTag</data>
                                                        </decorator>
                                                        <options>
                                                                <tag>span</tag>
                                                                <class>checkbox</class>
                                                        </options>
                                                </data>
                                                <label>
                                                        <decorator>Label</decorator>
                                                        <options>
                                                                <class>left</class>
                                                        </options>
                                                </label>
                                                <description>
                                                        <decorator>Description</decorator>
                                                        <options>
                                                                <tag></tag>
                                                        </options>
                                                </description>
                                                <row>
                                                        <decorator>
                                                                <row>HtmlTag</row>
                                                        </decorator>
                                                        <options>
                                                                <tag>div</tag>
                                                                <class>row</class>
                                                        </options>
                                                </row>
                                        </decorators>
                                </options>
                        </newsletter>
                        <gender>
                                <type>radio</type>
                                <options>
                                        <label>Geschlecht</label>
                                        <required>true</required>
                                        <multiOptions>
                                                <m>männlich</m>
                                                <w>weiblich</w>
                                                <x>sag ich nicht</x>
                                        </multiOptions>
                                </options>
                        </gender>
                        <send>
                                <type>submit</type>
                                <options>
                                        <label>Absenden</label>
                                        <decorators>
                                                <viewhelper>
                                                        <decorator>ViewHelper</decorator>
                                                </viewhelper>
                                                <data>
                                                        <decorator>
                                                                <data>HtmlTag</data>
                                                        </decorator>
                                                        <options>
                                                                <tag>div</tag>
                                                                <class>element</class>
                                                        </options>
                                                </data>
                                                <row>
                                                        <decorator>
                                                                <row>HtmlTag</row>
                                                        </decorator>
                                                        <options>
                                                                <tag>div</tag>
                                                        </options>
                                                </row>
                                        </decorators>
                                </options>
                        </send>
                </elements>
        </contactform3>
</config>

 « Return to Thread: Using Zend_Form::setElementDecorators() with Zend_Config_Xml

LightInTheBox - Buy quality products at wholesale price