lookup event

Previous Next

You can use the lookup event to replace the default USoft lookup behavior by custom behavior, or to restrict the default behavior to cases in which some condition applies.

The default lookup behavior is that when the user clicks a lookup button next to a foreign key field, the corresponding lookup page is displayed. This page allows him to select a value from the parent table.

This default behavior is implemented by generating the .navigateToLookup() method of the UDB object.


To restrict the lookup behavior to cases in which condition applies, follow these steps:

1.Identify the InputControl object for which USoft will generate the lookup button. In a USoft default application, this is NOT the column control (which has a type such as "TextColumnControl"). Instead, it is the object that appears in the Object Tree with the name "Data" and a type such as "TextControl".
2.Insert an Event Listener into this InputControl object. To do this, choose Insert, Event Listener from the main menu, or drag an Event Listener from the Controls Catalog.
3.Make sure the inserted Event Listener has Event Type = lookup. (The synonym 'onlookup' is also supported, for backward compatibily only.)
4.In the inserted Event Listener, insert a CallClientScript action, and set the Script of this action to:

if ( condition )

  $.udb.navigateToLookup("lookup page", { ... });


CAUTION: When USoft publishes runtime lookup behavior, it generates a lookup button and transfers the lookup behavior defined for the InputControl onto the 'onclick' event for that button. The lookup behavior you specify will only be transferred successfully if you script against Web Designer objects as explained in the steps of this help topic. The following attempt at a fully programmatic approach would be unsuccessful:

$(".InputControl").on("lookup", function(evt, options) {

if ( condition )

  $.udb.navigateToLookup("lookup page", { ... });



See also

Control Events