2 Replies Latest reply on Jun 26, 2007 6:28 PM by Eric Jung

    a4j popup

    Eric Jung Newbie

      Hi,

      When an a4j:commandButton is clicked, I'd like a execute javascript that opens a lightbox window (example: http://prototype-window.xilinus.com/samples.html) to show an activity indicator and then the results of the ajax call.

      Previously, I've coded this without a4j. What's the best way to do this with a4j? I suspect a4j:jsFunction might help, but I don't really understand a4j:jsFunction very well... the documentation at http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/devguide/en/html_single/index.html#jsFunction is difficult to apply to real world applications.

      Thank you for any ideas,
      grimholtz

        • 1. Re: a4j popup
          Sergey Smirnov Master

          a4j:commandButton has onclick and oncomplete javascript hookups you can use to execute javascript before Ajax Request is sent or after the Ajax Response is received. You do not have to use something more (like a4j:jsFunction) here.
          You can activate a4j:poll component from a4j:commandButton 'reRender' that will send periodical requests in order to update your indicator .

          a4j:jsFunction might be useful if you already have some javascript code and want to utilize it in the new version of your old application. a4j:jsFunction is similar to a4j:commandButton, but activated from the javascript code. It allows to invoke some server side functionality and use the returned data in the javascript function invoked from 'oncomplete'

          To see how jsFunction works on practice, look at a4j-jsFunction example from here: http://labs.jboss.com/jbossajax4jsf/demo/index.html

          • 2. Re: a4j popup
            Eric Jung Newbie

            Thank you, Sergey.