0 Replies Latest reply on Aug 13, 2011 10:23 AM by Valter Henrique

    JSF 2: How show different ajax status in same input?

    Valter Henrique Newbie

      I would like to validate every field in my form when each field  lose the focus, when this happens i would like these actions happen:

       

       

      1) in the right side of the field appears an image, a .gif (to represent that the system is checking the user input)

       

       

      2) when finished  appears another .gif (which depends of the input, 'sucess.gif' or 'error.gif', for example) and a message on the right side.

       

       

      I don't want to use popup or something like, the user is gonna lose  usability  and i don't want this.

       

       

      I'm trying to do something like this, this is what i have done so far:

       

          <h:form id="form">
              <h:panelGrid columns="3" >
                  <h:outputLabel for="first_name" value="First Name:" />
                  <h:inputText id="first_name" value="#{register.bean.firstName}" >
                      <f:ajax event="blur" render="m_first_name" />
                  </h:inputText>
      
                  <a4j:status name="ajaxStatus">
                      <f:facet name="start">
                          <h:graphicImage name="loader.gif" library="images" />
                          <h:outputText value="Processing ..." />
                      </f:facet>
                  </a4j:status>
      
                  <a4j:commandButton value="Register !" action="#{register.validateName}" status="ajaxStatus" />
      
              </h:panelGrid>
          </h:form>
      

       

       

      I was searching for some solution on Google and I think

       

       

          <a:a4j ... >

       

       

      is my best option, because of the `onbegin` and `oncomplete` attributes.

      There's some attribute as these in some native tag in JSF 2 ?