4 Replies Latest reply on Nov 16, 2009 2:29 AM by Raihan Kibria

    Any way to cancel reRender/conditional reRender

    Raihan Kibria Newbie

      Hi Users,

      Please let me say at first what is working: I have a form which I would like to submit by a4j:commandButton. Upon successful submission, the code reRenders the panel the form is in. I have somthing like <a4j:commandButton reRender="ContainerPanel" action=...

      The reason I reRender the panel the form is in is that once successfully submitted the form should go away and in its place the view form (containing what user just has submitted) should show.

      Upon unsuccesful submission I would not like to reRender the panel at all. This is because I would like the user to correct the inputs in the form. In other words, the form should remain as it was. I would like to have an ability to stop "reRerender"-ing in case on the server side I find a problem with the values user has input.

      Is it possible to cancel reRendering?

      Thanks for your messages.


        • 1. Re: Any way to cancel reRender/conditional reRender
          Ilya Shaikovsky Master

          you could point reRender to List of ids or just String(comma separated list) and fill the list in your action. If submission is not successful - the action will not be called and the list will remains empty.

          • 2. Re: Any way to cancel reRender/conditional reRender
            Raihan Kibria Newbie

            Thanks a lot. It works fine just like you told. I really appreciate from the bottom of my heart your solution.

            I am just wondering whether to make a new feature request. It looks as if it will do good if we could write something like

            <a4j:commandButton reRender="ContainerPanel" reRenderCondition="#{serverSide.successfulOperationBoolean}" action=...

            I have been developing with richfaces for quite a while now..and find richfaces excellent in every aspect. My style designer likes to rearrange forms including changing IDs of the components. Having to mention IDs on the server side diminishes the loose coupling of UI with server side actions and beans. Just wondering whether a new feature request is warranted.

            You guys are great. Thanks a lot for everything.


            • 3. Re: Any way to cancel reRender/conditional reRender
              Nick Belaevski Master

              Hi Raihan,

              This can be rewritten as:

              <a4j:commandButton reRender="#{serverSide.successfulOperationBoolean ? 'ContainerPanel' : null}" action=...

              Are you ok with such solution?

              • 4. Re: Any way to cancel reRender/conditional reRender
                Raihan Kibria Newbie


                Thanks for your really prompt reply. I have nothing to say but just profound gratitude. The solution you provided is perfect for me.

                Over the years I have converted some applications made with MyFaces/ tomahawk to richfaces. When I had started jsf richfaces were not so popular, therefore, I had to stick to myfaces/tomahawk. My experience was that to work independently with a style designer, it helps to de-couple UI from the backing beans.

                Your solution is perfectly in line with my development. Just awesome!

                Thanks and hope I will from time to time ask for some fore advice.