2 Replies Latest reply on May 25, 2010 9:16 PM by samuraicoder

    S:Decorate not firing? or my code is missing something.

    samuraicoder

      My code below is similar to many other fields that ARE validating, but this field will not get decorated for some reason. Possibly because it is in it's own render..?


      <a:outputPanel id="cidAjax">
           <s:fragment id="cidFragment" rendered="#{3 == customerSession.orderPaymentMethod.creditCardType}">
                <s:decorate id="cidDecoration" template="layout/cleanEdit.xhtml" encloseTemplate="false">
                <ui:define name="label">
                <label id="creditCardCid_label" for="creditCardCid">CID:</label>
                <h:inputText id="creditCardCid" name="creditCardCid" required="true" value="#{customerSession.orderPaymentMethod.creditCardCid}" size="4" maxlength="4" />
                </ui:define>
                </s:decorate>
           </s:fragment>
      </a:outputPanel>



      The s:decorate code when it fails to validate the CID field (for american express cards only) is from the same template.




      <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">
           
           <s:span styleClass="#{invalid?'errors':''}">
                <ui:insert name="label" /> 
                <s:message styleClass="#{invalid?'errors':''} errorLabelMessage"/>
                <s:validateAll>
                          <ui:insert />
                </s:validateAll>
           </s:span>
           
      </ui:composition>



      So the CID field should end up with a span around the Label the field and the erromessage in red text.


      What am I doing wrong?




        • 1. Re: S:Decorate not firing? or my code is missing something.

          Dan, a few questions/comments about your problem.


          1) Are you sure that the rendered condition on your decorate is being met? 


          2) Does the field show but is just not validated?  This is an important difference.


          3) Is orderPaymentMethod an object and what is the validation constraint on orderPaymentMethod.creditCardCid?


          Thanks.

          • 2. Re: S:Decorate not firing? or my code is missing something.
            samuraicoder

            1) Are you sure that the rendered condition on your decorate is being met?

            Yes it is being displayed in the view throughout.



            2) Does the field show but is just not validated? This is an important difference.

            I am not sure about 2), it definitely is not validating which means it COULD maybe not be validating against Hibernate?



            3) Is orderPaymentMethod an object and what is the validation constraint on orderPaymentMethod.creditCardCid?

            Where would I look to find the validation constraint?



            Thanks much.