Creator Help

Cancel Submit

Table of ContentsDown

Description

The cancel submit deluge statement is used in Form Actions - < On Add / On Edit > - Validate block to stop a form from being submitted. The default action of the validate script in the "on add" or "on edit" block, is to submit the data, so you have to do a cancel submit if you want to stop a form from being submitted. While using the validate script in the Form Actions - On "on delete" block, you have to do a cancel delete to stop a form from deleting data.

Syntax


// specify validation code
{
// specify alert message if not valid and cancel the submission
alert "<alert message>";
cancel submit;
}

Note:

  • The alert message in 'on submit' will be invoked only in the presence of a 'cancel submit'. In the absence of form cancellation, the alert message is bypassed by Zoho Creator.

Examples

  1. Alerts the message specified in quotes and cancels submission, if the value entered in the age field is not between 20 and 100. The script is added to the Form Actions - On Add / On Edit - Validate block of the form.


    if (input.Age < 20) && (input.Age >100)
    {
    alert "age should be between 20 to 100";
    cancel submit;
    }

  2. The code snippet given below fetches the data corresponding to the particular position applied by the applicant and checks if the Status for that position is currently closed and displays an error message to the user. You can access all the details related to that position by accessing the variable “opening”.  The script is added to the Form Actions - On Add / On Edit - Validate block of the form.


    opening = New_Opening [Position_Name == input.Applied_For];
    if (opening.Status == “Closed”)
    {
     alert “The job profile ” + this.Applied_For + ” for which you have applied is not currently open “;
    cancel submit;
    }


Top