Toggle menu

Invoking Custom Field Functions

Some of the more complex field types have additional actions that can be accessed via custom functions. These custom functions are executed client-side only.

The location picker field is a good example. It has three custom functions: search, hideMap and showMap. All custom functions are invoked using:

helper.invokeCustomFieldFn( fieldName, fnName [, args] )

In this example a standard text input, called TEXT, has a handler that invokes the custom search function of the location picker field (called LOCATIONPICKER), passing its value to it. The standard search button of the location picker field has been hidden.

The location picker also includes a handler, that updates the MESSAGE box.

The TEXT Field Handler Function:

function (helper, fieldName, value, valid, eventName) {
    if (valid) {
        helper.invokeCustomFieldFn('LOCATIONPICKER', 'search', value);
    }
}

The LOCATIONPICKER Field Handler Function

function (helper, fieldName, value) {
    helper.setFieldValue("MESSAGE", "Location: " + value);
}

Share this page

Facebook icon Twitter icon email icon

Print

print icon