nishtahir / gwt-pectin

Automatically exported from code.google.com/p/gwt-pectin
0 stars 0 forks source link

Feature: validateUntilFirstError(), because validate() always validates all fields #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. if you defined a form validation the validate() function will always 
validate all fields
2. if you change the class="" of the fields that are invalid then all invalid 
fields classes are changed at once 

What is the expected output? What do you see instead?
a new function "validateUntilFirstError" in 
com.pietschy.gwt.pectin.client.form.validation/FormValidator.java that 
validates the fields in the right order and stops at the first error

What version of the product are you using? On what operating system?
0.8

Please provide any additional information below.
can be solved by adding a sorted list of validators:
private ArrayList<HasValidation> sortedFieldValidators = new 
ArrayList<HasValidation>();
Instead o iterate over all validators in no specific order like in validate:
for (HasValidation validator : fieldValidators.values())
you could iterate over the sorted validators and stop when error occurs:
for (HasValidation validator : sortedFieldValidators)

Original issue reported on code.google.com by stefan.k...@gtempaccount.com on 18 Apr 2011 at 7:42