Feature Requests item #1072080, was opened at 2004-11-23 21:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1072080&group_id=119783
Category: core
Group: None
Status: Open
Priority: 9
Submitted By: Eelco Hillenius (eelco12)
Assigned to: Eelco Hillenius (eelco12)
Summary: Form Validation executed on all form elements
Initial Comment:
Currently, the form validation algoritm is (as
described in the Javadoc of Form.validate()):
/**
* Validates all children of this form, returning
the first error that occurs return
* Validation error or IValidator.NO_ERROR if every
HtmlFormComponent in this
* container validates
* @return Validation error or IValidator.NO_ERROR
if no error occurred
*/
I think this is not a good idea, as the common case (at
least in *all* the projects I have seen so far) is to
check all fields on errors instead of stopping
validation on the first error. Take the CD app as an
example... the following validation does apply:
title: required and < 50 chars
performers: required and < 50 chars
label: < 50 chars
year: must a valid integer
If the user submits an empty form, I want errors
displayed for both title and performers (required)
And, for example, if the user fills in title with a
string of over 50 chars, leaves performers empty, and
enters a non-numeric value for year, I want to display
those three errors (probably together with an indicator
for each field, e.g. changing the class of the field in
order render it's background red).
So, I think the algoritm should be like:
for all fields:
- execute validations until either:
- all registered validations for that field are
done without errors, or
- a validation fails, in which case the error
should be recorded (somewhere), and no further
validations should be executed for that field.
- after all fields are processed, check if any errors
were recorded, and - if so - do something usefull with
it (like calling
IValidationErrorHandler.validationError, though I also
do not agree with the current behaviour of allways
calling this method; I think it should be called on
errors only).
To implement this, we'll probably need to introduce a
field (like a List or a Map) in Form to record the errors.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=684978&aid=1072080&group_id=119783
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
Wicket-develop mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/wicket-develop