On Add ->On Validate

On Add ->On Validate section in Deluge is used to write the Form validation scripts. You can check for field values and tell the user to enter the right value. This part is executed after user clicks on the Submit button and before adding the record to the database. This script will also work when you import data, add records via email and duplicate the records.

For example, if you want to confirm a user’s email address using two fields Enter your Email and Confirm your Email and give an error if emails do not match, you can use the On Add ->On Validate script section.
  1. See https://creator.zoho.com/sampleapps/script-actions/#Form:On_Validate and give different email addresses for the fields you see there and click on Submit. 
  2. Access https://creator.zoho.com/sampleapps/script-actions/#View:On_Validate_View , click on Add and do the same. 
After you click on Submit (with different data for emails), you will see the message as “Invalid Entries Found” and “Email Addresses do not match“.
Note that this is different from the default Zoho Creator Form validation. If you did not enter the value in an email format, Zoho Creator will give “Invalid Entries Found” error. Because, they are both email fields and Zoho Creator will look for an email value in there.
How is the Message displayed?
  1. if statement is used to compare emails.
  2. alert task is used to display custom message.
  3. cancel submit task is used to cancel the Form submission in case of failures. 
How to reach the On Add ->On Validate section?
  1. Edit your application (by clicking on Edit this application link, or from the home page, click on the Edit link next to your application)
  2. Select your Form from the Forms tab. 
  3. Next to the Form name, click on More Actions ->Script (On Add) ->Validate on Form Submit.
This will take you to the On Add ->On Validate section of your Form’s script. You can drag and drop the deluge tasks from the left side to write your business logic there.