3 Replies Latest reply on Jul 11, 2014 4:43 AM by michpetrov

    <rich:toggleControl> always submitting

    matinh

      Hi!

       

      I want to implement a wizard similar to what's shown on RichFaces showcase for togglePanel. However, I want an abort-button, that I do not want to submit my form (actually I don't care about the values, I just want no validation to happen, as some fields are marked required). I created an <a4j:commandButton> with a <rich:toggleControl> inside:

       

          <a4j:commandButton immediate="true" execute="@none" value="Cancel" action="#{myBean.someAction()}">
            <rich:toggleControl targetItem="start" event="click" />
          </a4j:commandButton>

       

      Whenever I click the button, a full (Ajax-)submit of my form occurs, regardless what I set immediate or execute to. Event an <a4j:region> around the button still submits the whole form. It seems <rich:toggleControl> doesn't honor the settings of the surrounding component. Am I doing something wrong or is this a bug?

       

      tia,

      - martin

        • 1. Re: <rich:toggleControl> always submitting
          michpetrov

          Hi,

           

          the toggleControl works correctly. What makes the ajax call is the togglePanelItems being switched. If you don't want that to happen you have to change the first item's switchType to client before you switch to it. You can add onclick="#{rich:component('firstItemId')}.switchMode = 'client'; on the button, then of course you should change it back.

          • 2. Re: <rich:toggleControl> always submitting
            matinh

            I didn't try your suggestion yet, as I already found some other (hacky) workaround for my use-case. But I'll have a look at it soon. Thx for your suggestion.

             

            Anyways, if the togglePanelItem triggers the submit, shouldn't it then have attributes like 'execute' or 'immediate', just like a commandButton?

            • 3. Re: <rich:toggleControl> always submitting
              michpetrov

              Martin Höller wrote:

               

              Anyways, if the togglePanelItem triggers the submit, shouldn't it then have attributes like 'execute' or 'immediate', just like a commandButton?

              No, the submit is triggered because the togglePanelItem needs to update its content, it's only executing itself.