Adding JavaScript Code to Quick Selectors


You can add JavaScript code to individual quick selectors using the Add button on the Quick Selector page in the Admin application. You can configure filters of type Required or Validate for quick selectors. The supported event handlers are shown below.
 

To add JavaScript code to quick selectors

  1. Start the Admin application.
  2. Click Quick Selector on the vertical navigation bar, and then click the quick selector that you want to modify.
  3. In the section for Filters, you may either Edit or Add.
  4. In the dialog box that opens, enter the following information:
    1. Type. Quick selector currently support two contexts for JavaScript: Required or Validate.
      1. Select Required to configure conditions, exclusions, and filters for the quick selector.
      2. Select Validate to configure a Validate button for the quick selector.
    2. Label. This is a text field. Enter a label describing the purpose of your configuration.
    3. Expression. Enter the JavaScript code in the Expression input box. Note that the event handlers must be the first methods mentioned in the inline JavaScript code in the Expression input box because the first methods are automatically registered as the event handlers. Any event handlers that are stored in libraries will not be called.
  5. Click Save.

This Table describes the filters that you can configure for quick selectors and shows the supported event handlers.

Quick Selector Filter Type

Description

Available Events

Required

The Required context is typically used when the quick selector list is loaded to identify and modify the set of records available in the quick selector list.

You can use the Required context to configure conditions, exclusions, and filters for the quick selector list.

conditionQueryJSON excludeFromPreload
fieldsOnConditionQuery or
conditionQuery fieldsOnFilter or onFilter

Validate

The Validate context is typically used when the Validate button is selected in a quick selector list.

You can use the Validate context to configure a Validate button for the quick selector list.

onValidateJSON


For more information about JavaScript and quick selectors, see  Using JavaScript Code to Filter Information in Swift MEAP.