2 Replies Latest reply on Aug 6, 2008 4:05 AM by tomsimmons

    a4j:commandButton oncomplete

    tomsimmons

      Hi Folks

      I understand that the oncomplete is processed upon after client side work is finished, so I'm not sure if this is possible, however.....

      The problem I have is that if a problem is detected/occurrs in the backing bean code called by the action attribute of the a4j:commandButton then I can set a message that will be displayed, but the oncomplete still happens.

      In my case I use the button to launch modalPanel, but if something is wrong, the panel appears anyway.


      Tom

        • 1. Re: a4j:commandButton oncomplete
          liuliu



          use something like "if (data) showModel" in oncompete.

          • 2. Re: a4j:commandButton oncomplete
            tomsimmons

             

            "liuliu" wrote:


            use something like "if (data) showModel" in oncompete.


            Thank you, worked a treat.

            For other folks reference:

            I added a boolean in the backing bean (easier than mucking around with making the entire custom object JSON able), added the getter and setters for it in the backing bean.

            In the JSP, added

            data = "#{backingbean.boolean}"

            to the a4j:commandButton attributes. Obviously needs to be your backing bean name and the accessor to your boolean. In the oncomplete modified it to

            oncomplete = "if (data) javascript:Richfaces.showModalPanel(.....{....});"

            Tom