#427: [Patch] AgaviFormPopulationFilter - Display Inline Errors
-------------------------+--------------------------------------------------
Reporter: RossC0 | Owner: david
Type: enhancement | Status: new
Priority: normal | Milestone: 1.0
Component: _OTHER_ | Version: 0.11.0RC2
Severity: normal | Keywords:
-------------------------+--------------------------------------------------
This patch provides configurable inline errors messages, when using the
FPF.
The configurations are in global filter i.e.:
{{{
<filter name="FormPopulationFilter" class="FormPopulationFilter"
enabled="true" >
<parameters>
<parameter name="methods">
<parameters>
<parameter>write</parameter>
</parameters>
</parameter>
<parameter name="error_display_inline">
true
</parameter>
<parameter name="error_element_container">
<![CDATA[<div class="flash bad"><label
for="${id}">${messages}</label></div>]]>
</parameter>
<parameter name="error_message_container">
<![CDATA[<p>${error}</p>]]>
</parameter>
<parameter name="error_message_xpath">
<![CDATA[<p>${error}</p>]]>
</parameter>
<parameter name="error_element_form_xpath">
<![CDATA[//[EMAIL PROTECTED]"dt-${id}"]]]>
</parameter>
</parameters>
</filter>
}}}
This will add Error Messages when I enter bogus email addresses like so:
{{{
<div class="flash bad"><label for="email"></label><p>Invalid Email
Address</p></div>
<dt id="dt-email"><label for="email" class="error">Email:</label></dt>
<dd id="dd-email">
<input class="long error" name="email" id="email" value="" type="text">
</dd>
}}}
Because Xpath seems to be a b*tch - I've had to use naming conventions and
do substitution on the ''error_element_form_xpath'' so I replace ${id}
with the elementId of the input that errored - in this case email.
It nicely wraps mulitple error messages for me in a <p> so you can really
tell people off for not doing their forms correctly :)
Patch is incoming...
--
Ticket URL: <http://trac.agavi.org/ticket/427>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets