Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
 /*  
  * Custom Javascript here.  
  */   
   var CustomEventHandlers = {     
    setup: function (el) {       
        if (CustomView.hasClass(el, 's-submit'))       
        {  
            alert('setting up s-submit events');         
            FEvent.observe(el, 'click', this.submitClicked.bindAsObserver(this,el));         
            FEvent.observe(el, 'mouseover', this.submitMouseOver.bindAsObserver(this,el));         
            FEvent.observe(el, 'mouseout', this.submitMouseOut.bindAsObserver(this,el));       
        }     
    },     
    submitClicked: function (evt, el) {       
        alert ('Submit button was clicked');     
    },     
    submitMouseOver: function (event, element) {       
        alert ('Submit mouse over');     
    },     
    submitMouseOut: function (event, element) {       
        alert ('Submit mouse out');     
    } 
}

...

Extensions for flows

...

In addition to the above, flows also support a few other methods. <pre>  

Code Block
var CustomFlowEventHandlers =

...

 {     
    onNextClicked: function (name, id) {       
        alert ("Next button clicked for activity: " + name);     
    },     
    onNavClicked: function (name, id) {       
        alert ("Nav button clicked for activity: " + name);     
    },     
    onSaveSuccess: function (submissionId) {       
        alert ("Save complete. New submission id is: " + submissionId);     
    },     
    onSaveFailure: function () {       
        alert ("Save failed");     
    }   
}

 As the method names indicate

  1. onNextClicked() is called when the Continue button is clicked: this button might be labeled Continue or Finish or might have a custom label assigned by you. The parameters are the name and id of the current activity (step) in the flow.

...

  1. onNavClicked() is called when the user clicks on a link in the Navigation toolbar if it is displayed. The parameters are the name and id of the activity (step) in the flow that is clicked.

...

  1. Finally, onSaveSuccess() and onSaveFailure() for flows must be defined in the CustomFlowEventHandlers class.

It's not currently possible to directly fire a custom.js handler from a business rule. You can write a form.load rule that sets the value of a hidden control and set a change handler for that control in your custom.js Custom Handlers.