1 Reply Latest reply on Mar 10, 2010 1:59 AM by harut

    Ajax.Submit() with h:commandbutton

      Hello.

       

      I do have a requirement where I have to use a h:commandbutton  with ajax "Support"  e.g. I have to fire the ajax request with the onclick event.. So I'd like to submit the form with Ajax.Submit(), then have to reload another side and close the actual window (which is a greybox!!!) Obviously it doesn't work with a normal commandbutton, because after closing th greybox (http://orangoo.com/labs/GreyBox/) with a JS Function called parent.parent.GB_hide my action gets lost because no window is currently open anymore.    My Question therefore is how can I specify an action !!  which is executed when the form is submitted to the server and how can I set  Request params with value ? FOr example my checkbox has an ID of CheckID and I'd like to send it with value 1 ? How has the ajax.submit () look like ?

       

       

      Thanks in Advance

       

      rhino

        • 1. Re: Ajax.Submit() with h:commandbutton
          harut

          If you need commandButton which should have ajax functionality, then no need to use h:commandButton, use a4j:commandButton. And if you want to do any action after ajax request related action (in your case close the window...), then you can call corresponding JS function in "oncomplete" attribute of a4j:commandButton.


          My Question therefore is how can I specify an action !!  which is executed when the form is submitted to the server and how can I set  Request params with value ? FOr example my checkbox has an ID of CheckID and I'd like to send it with value 1 ? How has the ajax.submit () look like ?
          Write ActionListener method for mentioned commandButton. Value of the checkbox will be set to the property of the Bean class which checkbox has as it's value (<h:selectBooleanCheckbox value="#{aneBean.booleanProperty}"/>) before the ActionListener method will be called. So in that method boolean property which corresponds to the checkbox value will have it's actual value...