This content has been marked as final.
Show 3 replies
-
1. Re: How works validation?
nickarls Feb 20, 2008 10:04 AM (in response to pettersonfp)
Petterson Paula wrote on Feb 20, 2008 07:25 AM:
Hello,
When you annotate a bean (i.e.: using @Range), when the validation fails, seam put a message in the proper field of the form. How is that accomplished?
I would like to perform validations during the execution of an action that cannot be put in a Validator, is it possible to throw some exception during the validation that will be shown at the form as a message?
Thanks in advance,
Petterson
Well, you could always write a standard JSF validator (manually or through Seam) but if you look at the Hibernate Validator docs, it is hard to find stuff that can't be done with custom validators there.
-
2. Re: How works validation?
mail.micke Feb 20, 2008 10:42 AM (in response to pettersonfp)Yepp,
you can do validation in the action method and display messages.@In FacesMessages facesMessages;
// In your action, not important to specify correct component id facesMessages.addToControl( "serverSideForm:endDate", new FacesMessage(FacesMessage.SEVERITY_ERROR, "message summary","message details") ); return null;
Can't quite remeber if the order of the message detail/summary parameters.
There is some informatin about this here (not using seam):
TutorialGood luck
-
3. Re: How works validation?
mail.micke Feb 20, 2008 10:48 AM (in response to pettersonfp)Small type with severe consequences...
This
// In your action, not important to specify correct component id
Should be
// In your action, note important to specify correct component id
:)