Deluge Developer Guide > Field Actions > Field Actions - On User Input

Field Actions - On User Input

Tags:  

Field Actions - On User Input

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 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.)

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

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

     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.

Related Links

Tips & Tricks -> Dynamically Adding Items to a Picklist
Tips & Tricks -> Creating a Simple Store app


1 Comments  Show recent to old
tonythomas, 181 - days ago  

Please list all controls that behave this way and those that do not. I believe that changing the current selecition in a radio button list set will not trigger the OnUserInput.

Post a comment



 RSS of this page