Skip to content

Inline Script

Overview

The Inline Script plugin enables users to execute custom scripts within the form based on custom properties. This feature provides flexibility for implementing advanced logic directly within the form without needing external scripting.

Usage

To use the Inline Script plugin, follow these steps:

  1. Define custom properties in the screen's custom properties. Add a custom key execute_inline with value true. Then add custom properties with keys of events and value is script. The keys for these properties should be events i.e, on_next, on_next_pre, on_back, on_enter, or on_input_change to specify when the script should be executed.
  2. Set the value of these properties to the JavaScript code you want to execute.

Benefits

  • Allows setting execution of custom scripts within the form.
  • Enhances the flexibility and customization of form logic.
  • Supports a variety of events: on next, on previous, on back, on enter, and on input change.
  • Facilitates the implementation of complex logic without external logic units.

By following these steps, you can effectively integrate and utilize the Inline Script plugin to enhance the functionality of your forms.

Example

Let's say if first screen is text input and name test is not allowed, then add custom property.

key: execute_inline value: true key: on_next_pre value:

(function () {
    if (inputs[0] == 'test') {
        $.OverrideValidation(false, "You cannot use this name.");
    }
})()