Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This function cancels an event and prevents it from bubbling up.

Parameters:

  • event – event name to cancel

Example:

In this example, we prevent the onclick event if other fields on the screen are not validated properly.

Note: We assume that validated() is a custom-built function that is available for use. We also assume that validated() returns true or false to indicate the validity of certain fields on the screen.

var submitButton = getObj("my_button");

submitButton.onclick = function(event)

{
     if(!validated())      //if fields on the screen are not valid
     {
          preventEvent(*event*);
     }
}
  • No labels