Creator Help

Field Actions - On User Input

Table of ContentsDown

Overview

The On User input is a client side action which will be called whenever the value of a field is modified either by the user or through script. It is used to improve the usability of a form by validating field data even before it is submitted or display other field values based on the value specified in this field. The On user input script is executed before the changed data is persisted in the database.

The On User input script will not be called in the following cases:

  • if there is no change in the value of the field (i.e if the new value being set is same as the old value.). 
  • If fields are updated using custom actions in view.

Syntax

On User Input
{
// specify deluge code to be executed

}

Examples

Assume that in a form with Emailid field, a person can register with the same Email ID only once. This validation can be done in the On User Input event of the Email ID field. An Ajax request is sent to the server to validate the Email ID. If the same emailid already exists, an error message is displayed.

Deluge code snippet


if (count(Register[emailid == input.emailid]) > 0)
{
input.emailiderror = “This email id already exists”;
show emailiderror;
}

The above code is added to the On User Input block of the Email ID field.  In the above code, emailiderror is a "Add Notes" field type. This field is not displayed when the form is loaded. When the user inputs an emailid which already exists in the Register Form, the emailiderror field is displayed with the specified error message.

Top