-
1. Re: s:validate and Hibernate Validators
dan.j.allen Jun 21, 2008 12:12 AM (in response to admin.admin.email.tld)You can actually do this now. Seam just provides the information in a different way than you propose. If you wrap the field in an s:decorate tag, than within the Facelet component template the context variable
invalid
is set to either true or false depending on whether the validation failed. You can wrap JavaScript in a rendered block or you can use Ajax4jsf to fire the JavaScript function (I'm blanking at the moment on the exact technique).If one of the components was modified, it would need to be s:decorate not s:validate. The s:validate tag is just a JSF validator tag, so it is not rendered and therefore cannot put anything on the screen.
-
2. Re: s:validate and Hibernate Validators
admin.admin.email.tld Jun 21, 2008 1:07 AM (in response to admin.admin.email.tld)I have seen the s:decorate tag in the booking example. Here is the edit.xhtml that was being used in the s:decorate tag in book.xhtml.
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib"> <div class="entry"> <s:label styleClass="label #{invalid?'errors':''}"> <ui:insert name="label"/> <s:span styleClass="required" rendered="#{required}">*</s:span> </s:label> <span class="input #{invalid?'errors':''}"> <s:validateAll> <ui:insert/> </s:validateAll> </span> <s:message styleClass="error errors"/> </div> </ui:composition>
<s:decorate id="checkinDateDecorate" template="edit.xhtml"> <ui:define name="label">Check In Date:</ui:define> <rich:calendar id="checkinDate" value="#{booking.checkinDate}" required="true" datePattern="MM/dd/yyyy" event="onblur" reRender="checkinDateDecorate" style="width: auto;" /> </s:decorate>
I'm not sure exactly how to use the s:decorate with the s:validate and the hibernate validator in my scenario/problem.
I don't understand how you would apply the correct javascript function to the applicable field. I didn't find a similar example in your book's PDF or elsewhere.
BTW, your book was backordered on Amazon (as well as JBoss in Action) until next month....
-
3. Re: s:validate and Hibernate Validators
deanhiller2000 Nov 6, 2008 9:54 PM (in response to admin.admin.email.tld)maybe dig into <a:support> on rich faces? That is what triggers the onblur stuff and. I am not sure myself exactly what you are trying to do, but we use <a:support to rerender the component after changes to it so errors can be shown dynamically.