Skip to main content
Version: 11.2

before

note

This article is about the before UDB event handler.

before​

The before event may be called from web pages developed in Web Designer and processed by a USoft page engine service.

EventApplies toOccurs when
beforeData source objects (UdbDataSource)Before a Page Engine action that involves the data source

This event is triggered by the UdbDataSource class (via dsc.trigger('before', ...)), just before the action is sent to the server. Note that for the getDataSet action specifically, this event is only fired when the action is a "replace" (i.e. event.getParam('replace') is true); a plain, non-replace getDataSet() call does not fire before. For any other Page Engine action that involves the data source, the event always fires. The before event is raised as a consequence of the server handling Page Engine requests.

Purpose​

You can use the before event to show waitstates that you hide subsequently on the after event.

warning

The before event is not suitable for blocking or preventing the Page Engine action under specific conditions. For this purpose, use specific before... events instead, such as beforecheckdata.

How to use​

Find or create an Event Listener object with Event Type = before. Event Listeners are in the Web Designer Controls catalog:

Insert the event listener into the data source object. Insert a callClientScript action into the event listener. Use this action's Script property to code the behaviour that you want to see when the event occurs.

You are implicitly associating the event with an event handler function. This function has an options parameter. For available options, see the Options section at the end of this help topic:

function(*event*, *options*){ ... }

Options​

When the event occurs, the following event handler function is called. You can use this function's options parameter in your event scripting.

function( *event*, *options* )

*event* ::= jQuery.Event
*options* ::= *event-options*

*event-options* ::= {
action: *action*,
source: *source*,
args: *args*,
pKeys: *pKeys*,
showdata: *showdata*
}

Event contains the run-time details of the triggered event, of the event type stated above.

This syntax means that you can access an option by scripting:

options.*option*

Action is the name of the Page Engine action that is about to be executed, e.g. 'getDataSet'.

Source indicates what caused the action to be executed.

Args are the arguments that were passed to the action.

pKeys identifies the rowset that the action is being performed on.

Showdata indicates whether the resulting data should be shown.