Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
1.1.0
-
None
-
Operating System: other
Platform: Other
-
26668
Description
The problem is that after form validate method returns the collection of errors
it's hard to separate them into errors and messages. Very frequently there is a
need to render errors differently than the messages. The suggestion is to add
attributes errorsOnly=�true/[false]� to the html:errors and messagesOnly=�true/
[false]� to the html:messages tags. It’s very simple enhancement but it will
definitely be used a lot.
The ErrorsTag would have to be modified slightly to cast to ActionMessage base
class instead of ActionError and then the check for ActionError:
ActionMessage report = (ActionMessage)iter.next();
If(isErrorsOnly() && !(report instanceof ActionError)) continue;
Similarly, the MessagesTag can be enhanced to show only messages, ignoring the
errors:
ActionMessage report = (ActionMessage)iter.next();
If(isMessagesOnly() && report instanceof ActionError) continue;
Then in the action form’s validate method both ActionError and ActionMessage
instances can be added to the ActionErrors collection and then displayed
differently by html:errors and html:messages tags.
Note. There is currently a message attribute in the html:messages tag but it’s
not a convenient way to separate errors and messages in the action form.