3 Replies Latest reply on Mar 11, 2009 10:17 AM by ilya_shaikovsky

    a4j:jsFunction params - "how-to" ?

    krasig

      Hi all,
      is there any way to get parameters in a4j:jsFunction?
      What exactly I mean:

      <a4j:jsFunction name="myFunc"
       action="..."
       oncomplete="alert('Parm2')">
       <a4j:actionparam name="Parm1" assignTo=".."/>
       <a4j:actionparam name="Parm2" assignTo="..."/>
      </a4j:jsFunction>


      The important part is oncomplete="alert('Parm2')".
      How to show Parm2 value?

        • 1. Re: a4j:jsFunction params -

          Use the data attribute. See the example in 6.8.2 in dev guide for further informations.

          • 2. Re: a4j:jsFunction params -
            krasig

            I know how to use data attribute.

            • 3. Re: a4j:jsFunction params -
              ilya_shaikovsky

              1) passing parameters to request

              <... onclick="myFunc(1,2)"/> //Some component which calls the function.
              <a4j:jsFunction name="myFunc"
               action="...">
               <a4j:actionparam name="Parm1" assignTo=".."/>
               <a4j:actionparam name="Parm2" assignTo="..."/>
              </a4j:jsFunction>
              

              in this case params from call (1,2) automatically passed to Parm1 and Parm2 and could be used at server side.

              1) Using parameters from server side within oncomplete function:
              <a4j:jsFunction name="myFunc"
               data="#{userBean}" oncomplete="showTheName(data.name)" >
              </a4j:jsFunction>