Reference the oncomplete event by an external java script function
        Posted  
        
            by user339637
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user339637
        
        
        
        Published on 2010-05-18T09:26:24Z
        Indexed on 
            2010/05/18
            9:50 UTC
        
        
        Read the original article
        Hit count: 339
        
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.
Thanks
© Stack Overflow or respective owner