This content has been marked as final.
Show 1 reply
-
1. Re: form validation best practices in Seam
admin.admin.email.tld Jun 17, 2008 12:59 AM (in response to admin.admin.email.tld)http://demo.flamingo.exadel.com/booking/book.seam
seems to be validating onblur event...
so the edit.xhtml has a
<s:validateAll>
in it. The hibernate validators are fired by<a:support event="onblur" reRender="creditCardDecorate"/>
there is some additional validation in the SFSB method:
public void setBookingDetails() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -1); if ( booking.getCheckinDate().before( calendar.getTime() ) ) { facesMessages.addToControl("checkinDate", "Check in date must be a future date"); bookingValid=false; } else if ( !booking.getCheckinDate().before( booking.getCheckoutDate() ) ) { facesMessages.addToControl("checkoutDate", "Check out date must be later than check in date"); bookingValid=false; } else { bookingValid=true; } }
the bookingValid boolean variable is accessed in pages.xml for page navigation to the confirm page.
So basically, this form in the booking example is using both dynamic and on submit validation.