value
This article is about the value UDB event handler.
value
The value event may be called from web pages developed in Web Designer and processed by a USoft page engine service.
| Event | Applies to | Occurs when |
|---|---|---|
value | Custom UI controls | When the value of the custom control become programmatically available. |
This event is triggered by the InputControl$custom class (the InputControl subtype registered for controls with the Type property set to 'custom'), whenever the control's underlying value changes and a value Event Listener is defined for the control.
Purpose
You can use this event to adjust the way in which the value is displayed in the control.
How to use
Find or create an Event Listener object with Event Type = value. Event Listeners are in the Web Designer Controls catalog:
Insert the event listener into the object for the custom UI control. 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 mix the control value with an HMTL structure responsible for altering aspects of display style:
$(this).empty().append('<span data-lang="'+ options.value + '">' +
$.udb.msg.getString(options.value) + ':</span>');
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* ::= {
control: *control*,
value: *value*,
rawValue: *rawValue*,
isLookup: *isLookup*
}
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*
Control is the control instance that raised the event.
Value is the formatted (displayable) value of the control, i.e. the result of calling control.format() on the underlying value.
rawValue is the underlying, unformatted value of the control.
isLookup is a boolean indicating whether the control is a lookup control.