Skip to main content
Version: 11.2

postcommit

note

This article is about the postcommit UDB event handler.

postcommit​

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

EventApplies toOccurs when
postcommitPage objectsAfter each commit action

This event is triggered internally on the global UdbApplication object, from the commit() function of the UdbContext class.

Purpose​

You can use the postcommit event to obtain additional behaviour that depends on whether the commit ended successfully or not.

How to use​

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

Insert the event listener into the Page 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. A typical pattern is to test whether the commit completed successfully or not, and then script behaviour depending on this outcome. This pattern looks like this:

if (options.success)
// additional action if commit succeeded
else
// additional action if commit failed

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*){ ... }

Or you can create the event handler more explicitly by calling $.udb.on().

Example​

$.udb.on('postcommit', function(evt, options) {
if (options.success)
alert('Commit succeeded.');
else
alert('Commit failed.');
});

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* ::= {
success: *success*
}

*success* ::= { true | false }

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

This syntax means that you can access the success option by scripting:

options.success

You can use success to test whether the commit was successful. No caller options are passed with this event.