1 2 Previous Next 18 Replies Latest reply on Apr 3, 2009 10:43 AM by jeremygood Go to original post
      • 15. Re: <a4j:support> not working
        ilya_shaikovsky

        explain please more about #{invalid} context variable.

        • 16. Re: <a4j:support> not working

          From the Seam Reference Guide:


          32.1.3.1. <s:decorate>

          Description

          "Decorate" a JSF input field when validation fails or when required="true" is set.

          Attributes

          template: the facelets template to use to decorate the component

          #{invalid} and #{required} are available inside s:decorate; #{required} evaluates to true if you have set the input component being decorated as required, and #{invalid} evaluates to true if a validation error occurs.

          Usage
          
          
          <s:decorate template="edit.xhtml">
           <ui:define name="label">Country:</ui:define>
           <h:inputText value="#{location.country}" required="true"/>
           </s:decorate>
          
          <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>
          
           <s:label styleClass="#{invalid?'error':''}">
           <ui:insert name="label"/>
           <s:span styleClass="required" rendered="#{required}">*</s:span>
           </s:label>
          
           <span class="#{invalid?'error':''}">
           <s:validateAll>
           <ui:insert/>
           </s:validateAll>
           </span>
           <s:message styleClass="error"/>
          
           </div>
          
          </ui:composition>




          From Seam in Action, pg 90:
          #{invalid} and #{required} are available inside s:decorate; #{required} evaluates to true if you have set the input component being decorated as required, and #{invalid} evaluates to true if a validation error occurs.




          Both of these context values are apparently set to false when rerendering due to an ajax validate. They do have the correct values when the page is initially displayed and after a form submit.

          • 17. Re: <a4j:support> not working
            adubovsky

            Hello,

            Just make changes in reRender attribute of a4j:support. Set reRender all decorate tag:


            <a4j:support id="shortNameCheck" event="onblur" reRender="shortNameField"
             ajaxSingle="true" bypassUpdates="true" />


            • 18. Re: <a4j:support> not working

              Wow, thanks very much. That's exactly what was missing. I went back and checked Seam in Action, and indeed, the reRender attribute is there. I'm not sure how I managed to leave it off.

              Guess I feel pretty stupid about now.

              Thanks again.

              1 2 Previous Next