before... events

Previous Next

You can use the before... top-level events to block processing if the event occurs and a given condition is not satisfied. Do this by passing in a function with an options parameter and setting the success property of this options parameter to false.

The pattern is:

$.udb(datasource).on( event, function(evt, options) {

  if ( condition-not-satisfied ) {

    options.success = false;

    alert( message );

  }

});

 

For example:

$.udb("PRODUCT").on( "beforeexecutequery", function(evt, options) {

  if ( this.searchCols("PRODUCT_TYPE").val() == "" ) {

    options.success = false;

    alert( "To query, you must specify a product type." );

  }

});

 

 

See Also

Top-level Events