1 Reply Latest reply on May 18, 2010 6:55 AM by Nick Belaevski

    Reference the oncomplete by an external java script function

    wqe wqe Newbie

      Hi , I want to do some logic at the oncomplete attribute of the a4j:commandButton  ,but my logic is too complicated ,  can I reference the code using a java script functions located in a external java-script file to have a better maintenance ? I found it has error because the JavaScript file cannot understand the EL expression .


      For example , originally I have ,


          <a4j:commandButton id="btn1" action="#{MBena1.action1}" oncomplete="if( {MBena1.variable1}){Richfaces.showModalPanel('modelPanel1');};if (......) then ">


      I want to do something like this:


          <a4j:commandButton action="#{MBena1.action1}" oncomplete="Btn1OnComplete();"> 


      the code is put inside the java script function Btn1OnComplete() which is located in a external java-script file.