before... and rowpre... events

Previous Next

You can use the rowpre... and before... data source 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("PARTICIPANT").on( "rowpreupdate", function(evt, options) {

  if ( this.rows('current').cols("AGE").val() < 18 ) {

    options.success = false;

    alert( "Age may not be changed to a value under 18." );

  }

});

 

See also

Data Source Events