Skip to main content
Version: 11.2

colpostupdate

note

This article is about the colpostupdate UDB event handler.

colpostupdate​

The colpostupdate event may be called from web pages developed in Web Designer and processed by a USoft Page Engine service.

EventApplies toOccurs when
colpostupdateData source objects (UdbDataSource)After a value in a record is updated

This event is triggered internally by the UdbDataSource class, from a watch set up by the UdbRecord object that owns the updated value. Unlike colpreupdate, colpostupdate does not fire for query/filter value changes — it only fires for actual record values.

Purpose​

You can use this event to supplement a user UPDATE with follow-on actions based on the result of the update (the new values).

How to use​

Find or create an Event Listener object with Event Type = colpostupdate. 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*){ ... }

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

Example​

This example passes the result of the column update in a message to the user:

alert('The new value is ' + options.value);

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* ::= {
value: *value*,
oldValue: *old-value*,
col: *col*,
ref: *ref*,
mode: 'E',
hostvars: *hostvars*
}

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

This syntax means that you can access a caller option by scripting

options.*caller-option*

Value is the new value that the column was updated to. By this point the value has already been applied, so mutating options.value has no effect.

Old-value is the value that the column had before the update.

Col is the UdbColumn object of the column that was updated (not its name).

Ref is the underlying reactive reference that holds the column's value.

Mode is always 'E', since colpostupdate only fires for record value updates.

Hostvars is an object with the host variables that were passed along with the update.