Zoho Creator : Form input validation

An application that gives a free ride to input incorrect data is useless. So validating form inputs is one area that needs to be done carefully while creating applications. Zoho Creator allows you to accurately validate the form inputs and helps you to give clear feedback to the user when the form does not accept the data.

Here is an overview that will help you to utilize this feature in Zoho Creator to the fullest.

Validations during a form submit can be classified as

  • User interface validation
    You can specify the constraints for the fields you are defining while creating a form. If you define a field to be of type Email, Zoho Creator checks if the data entered in the form for that field is a valid emailid, else it displays an error message to the user. Half the validation is done if you choose the type of the form field appropriately. By default, Zoho Creator supports an adequate number of field types.
  • Writing algorithmic logic
    In addition to performing user interface validation, you might want to check the user input with the data that you already have. Zoho creator allows you to write deluge script(an on submit action) for custom validation that will get executed before the form data is persisted.

What really happens when you submit a form in Zoho Creator ?

    • Zoho Creator first validates the submitted data based on the type of the field and properties defined for each of the fields.
    • The on submit action gets executed in the server. The default action of an on submit script is to submit the data, so you need to do a cancel submit if you want to stop a form from being submitted. You can also choose to provide proper error message to the user while canceling.
    • The same form is then shown to the user to re-enter the data.

    Please note that the data gets persisted only if the on submit action does not get canceled.

    Let’s take a recruitment application for example to understand better. Consider a recruitment application has two forms:

    • Add Openings
      The admin can add/modify the openings available.
    • File Application
      Applicants can add fill in their details here. The admin can write deluge code to check if the application being posted satisfies the basic requirements, else he can display an error message and cancel the form submit.

    The on submit action that executed while submitting the “Post Application” form is given below.

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

    The code snippet given below fetches the data corresponding to the particular position applied by the applicant. You can access all the details related to that position by accessing the variable “opening”.

    opening = New_Opening [Position_Name == $Applied_For];

    The code snippet given below checks if the Status for that position is currently closed and displays an error message to the user.

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

    You can also read deluge help to learn more on scripting. Do try this feature and let us know your comments / suggestions.

    Comments

    Leave a Reply

    Your email address will not be published.

    The comment language code.
    By submitting this form, you agree to the processing of personal data according to our Privacy Policy.

    Related Posts