2 Replies Latest reply on Oct 12, 2010 7:28 AM by Kto ToTaki

    a4j:support nested in a4j:commandButton

    Kto ToTaki Newbie

      Hi,

      a4j:support nested in a4j:commandButton is NOT recommended, but in my case necessary to set  desired validation type before form is posted. 

       

      <h:form>
          <rich:graphValidator profiles="#{validationBean.validationProfil}">
         
          <h:inputText id="name"  value="#{bean.name}"  />
          
          <a4j:commandButton value="Next"  actionListener="#{...}" reRender="..." >
               <a4j:support immediate="true" event="onclick" actionListener="#{validationBean.useNextValidationProfil}" />  
          </a4j:commandButton>
         
          </rich:graphValidator>
      </h:form>

       

       

      What happends when user click a button:

      1. a4j:support fires, setting NextValidationProfil in validationBean

      2. form is validated

      3. getter/setter running

      4. a4j:commandButton actionListener executes in the end

       

      And it is desirable behavior. I have to set first desired profile, before getter/setter fires up.  But, a4j:support in a4j:commandButton cause concurrent requests to be send, and results can be unpredictable as the order of  requests processing could be lost. In my case, concurrent use of this code cause that button stops to work after 5-10 clicks.

       

      So, I need another solution to this. I have to perform an action BEFORE getter/setter is running, after actionListener is to late. 

       

      Any idea, how to get it?