-
1. Re: Extend Seam-Hibernate validation?
dan.j.allen Apr 20, 2009 7:13 PM (in response to arw)If you are performing a persistence operation, you can get the failed validations by catching the Hibernate-specific exception:
try { return super.persist(); } catch (org.hibernate.validator.InvalidStateException ex) { for (org.hibernate.validator.InvalidValue iv : ex.getInvalidValues()) { org.jboss.seam.faces.FacesMessages.instance().add(iv.getMessage()); } return "invalid"; }
-
2. Re: Extend Seam-Hibernate validation?
dan.j.allen Apr 20, 2009 7:14 PM (in response to arw)As for multiple error messages per field when using <s:validate>, currently there is no way to print any exception except the first since the validator ignores the others.
-
3. Re: Extend Seam-Hibernate validation?
arw Apr 20, 2009 7:20 PM (in response to arw)Thanks for the suggestion Dan but unfortunately at the point where we want to add this functionality we are not persisting anything.
A bit more info...
The user enters data into an HTML field, the value is applied to the backing bean onblur; the validators fire at this point and if the validation fails the area is rerendered and the field shows the 'errored state' on the page.
The idea is that behind the scenes we want to keep track of this failure... we aren't so much concerned with which validation rule failed just that the field in general failed to validate.
-
-
5. Re: Extend Seam-Hibernate validation?
asookazian Jan 29, 2010 12:53 AM (in response to arw)
al whiting wrote on Apr 20, 2009 19:20:
Thanks for the suggestion Dan but unfortunately at the point where we want to add this functionality we are not persisting anything.
A bit more info...
The user enters data into an HTML field, the value is applied to the backing bean onblur; the validators fire at this point and if the validation fails the area is rerendered and the field shows the 'errored state' on the page.
The idea is that behind the scenes we want to keep track of this failure... we aren't so much concerned with which validation rule failed just that the field in general failed to validate.If you are simply trying to count the number of validation error occurrences then maybe you can have a method which persists this data to a DB table by observing a raised event from the code above.