Reinhard Poetz wrote:
Reinhard Poetz wrote:
Sylvain Wallez wrote:
Now there's also the little-known <ft:validation-error> template
instruction that outputs the validation error or any given widget.
This can be a good replacement of the message widget, and would
allow non-visual widgets to be ValidationAware.
good idea! I implemented the ValidationErrorAware interface in Form
and Repeater. I fear this will not work in Ajax mode as the errors
are not reported to the client.
uups, sent this mail to quickly. I wanted to add that I don't have the
time to fix this ATM as I would have to dive into the Ajax
implementation to find out how to make this possible.
The main principle of the Ajax stuff is that each part of the page that
can be updated asynchronously (not necessarily a widget) must be fully
contained in a tag (span, div, input, whatever) with a unique id. In the
case of widgets, this id is the value of widget.getRequestParameterName().
We therefore need a distinct id for validation errors, which can be e.g.
{widget.requestParameterName}.$error, which uses the same $-prefix
convention as Java bytecode for synthetic names (those generated by the
program).
Update of the validation error is then linked to a change of its
associated widget. For now, change detection is a boolean thing (changed
/ unchanged) but we may go to something more fine-grained in the future
(e.g. value changed / error changed / selection list changed etc).
Sylvain
--
Sylvain Wallez Anyware Technologies
http://apache.org/~sylvain http://anyware-tech.com
Apache Software Foundation Member Research & Technology Director