Cancel Submit
Description
The cancel submit deluge statement is used in the Form
Action - Validate block to stop a form from being submitted.
Syntax
on submit
{
// specify validation code
{
// specify alert message if not valid and cancel the submission
alert "age should be between 20 to 100";
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.
Age
(
type = number
)
on submit
{
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.
on submit
{
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;
}
}
|
|