[jboss-user] [JBoss Seam] - Re: <s:decorate/>

gavin.king@jboss.com do-not-reply at jboss.com
Mon Oct 2 12:13:08 EDT 2006


"mzeijen" wrote : What does it do?

It is used for decorating form fields when validation fails. There are several facets: "beforeInvalidField", "afterInvalidField", "aroundInvalidField", (along with "beforeField", "afterField", "aroundField") that let you put decorations before, after, or around fields when a failure occurs.

eg:


  | <h:form>
  |    <f:facet name="beforeInvalidField">
  |       <h:graphicImage value="/attention.jpg"/>
  |    </f:facet>
  |    <f:facet name="afterInvalidField">
  |       <s:message/>
  |    </f:facet>
  |    <f:facet name="aroundInvalidField">
  |       <s:span styleClass="errors"/>
  |    </f:facet>
  | 
  |    <div>
  |       <s:decorate>Name: <h:inputText value="#{customer.name}" required="true"/></s:decorate>
  |    </div>
  |    <div>
  |        <s:decorate>
  |           Address: 
  |           <h:inputText value="#{customer.address}" required="true">
  |              <my:vaidateAddress/>
  |           </h:inputText>
  |        </s:decorate>
  |    </div>
  |    <div>
  |       <s:decorate>
  |          Email: 
  |          <h:inputText value="#{customer.email}"/>
  |             <my:validateEmail/>
  |          </h:inputText>
  |       </s:decorate>
  |    </div>
  | </h:form>
  | 

Then, when one of the fields is invalid, it will be shown in red with an image before it and the validation message after it.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975549#3975549

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975549



More information about the jboss-user mailing list