2 Replies Latest reply on Apr 10, 2010 7:09 AM by nbelaevski

    RichFaces Ajax ByPassing Validation for components

    oyesiji77

      I have about two inputText component on my page that accepts values and this input text are required,

      <h:inputText value="{}" required=true></h:inputText>
      <h:inputText value="{}" required=true></h:inputText>
      

      I have a a4j command button that is supposed to retrieve value via AJax
      <a4j:commandButton></a4j:commandButton>


      and another command button that submits the page
      problem is when i click the a4j:CommandButton the Validation kicks up, stating that values are needed for the
      InputText boxes. How do i bypass Validation whenever i click my a4j:CommandButton

        • 1. Re: RichFaces Ajax ByPassing Validation for components
          akaine

          Your problem is that while your button is in the same form as the fields the form is being submited and validated by the button.

          There are several options to bypass the validation:

           

          - add immediate="true" to the button:

           

          <a4j:commandButton value="pressme" immediate="true" />
          

           

          - add ajaxSingle="true":

           

          <a4j:commandButton value="pressme" ajaxSingle="true" />
          
          

           

          Personally I prefer the second option due to more adequate and responsive behavior.

           

          (sry, didn't see the post date xD)

          • 2. Re: RichFaces Ajax ByPassing Validation for components
            nbelaevski

            Hi,

             

            a4j:region is another option similar to ajaxSingle, but wraps several components.