Understanding Builder-Defined Events

Page Load

Page load events happen after the bundle page load event as defined in the Ready Options. Use this when you want to do something before the user interacts with the page.

Variables available to custom code by default:

  • element - The page object
  • event - Empty for page load events
  • action - Contains no actions for page load events
  • resource - Result of the bridged resource AJAX call if one was made

Page Submit

Page submit events happen before the page is submitted to the server.

Variables available to custom code by default:

  • element - The page object
  • event - Empty for page submit events
  • action - Contains stop/continue methods that control timing of the form submission when event contains asynchronous functions, see example below
  • resource - Result of the bridged resource AJAX call if one was made

Stop/Continue in submit events

The example below demonstrates how to use the stop and continue methods defined on the action object.

Note: Bridged resources used in a page submit event make asynchronous calls, but submissions are automatically stopped and continued.

// signals that the submission process should stop/wait, forgetting this call
// will result in the form being submitted before the response is received 
action.stop();
// make the ajax call
$.ajax({
    url: '...',
    type: 'GET',
    success: function(data, textStatus, jqXHR) {
        console.log(data);
        // signals that the submission process should resume, forgetting this 
        // call will result in never submitting the form
        action.continue();
    }
});

Field Change

Field change events fire on changes to their data, not necessarily just changes to the input element by the user. If a field change event changes another field’s value, that field will also fire a change event if one is defined.

Variables available to custom code by default:

  • element The field object
  • event The event object contains the members listed below
    • newValue The new value of the field when the change event was triggered
    • constraints The field constraint messages after constraints are evaluated using the new value
  • action Contains no actions for field change events
  • resource Result of the bridged resource AJAX call if one was made

Button Click

Button click events can be defined on custom button elements. They fire when the button is clicked.

Variables available to custom code by default:

  • element The button object
  • event The event object contains the members listed below
    • domEvent The original DOM event that resulted from the button click
  • action Contains no actions for button click events
  • resource Result of the bridged resource AJAX call if one was made