This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am using struts validator framework for both client and server side validations. The problem is validations of the same type occur together. But I want all validations for a particular field to be finished first and if that field passes all validations, then only validations for the next field should take place and so on. ex: say I have two text fields. field 1: validations are: required, mask (checks a regular expression) field 2: validations are : required, integer
if both the fields are empty,on click of submit button an alert is shown as: field 1 is required field 2 is required
but I want validation to stop after reporting validation error for field 1 only. Once both the validations for field 1 are done, then only it should alert for the second field.
Please help. I also tried with the "stopOnError" property in the plug-in tag in struts-config.xml, but it didn't work out.
I did a little searching around for that stopOnError setting (is it actually stopOnFirstError?). Looking at the source code for ValidatorPlugIn.java I see the following quotes:
"Informs the Validators if it has to stop validation when finding the first error or if it should continue. Default to true to keep Struts 1.1 backwards compatibility."
In the Struts 1.2.4 release notes I see the following quote:
subject: struts validator. stoping on first validation error.