Search

Validation

Last Updated: May 10, 2022

Articles

Validation is the process to ensure that data is entered into a field correctly. The value entered for the field is the right data and in the right format.

In Customer Detail Form, you must validate if the email id entered is a valid email id. .

  • Must contain '@' and '.' character.
  • There must be at least one character before and after '@'.
  • There must be at least two characters after '.' (dot).

Common validations done are:

  • Are all the mandatory fields filled?
  • Is valid date entered?
  • Is valid email id entered?
  • Is text entered in a numeric field?


Validations can be performed using the User-Defined functions. To know more about User-Defined functions, click here.

A field can have one or more validations based on the requirement, or none.

Create User-Defined function for validation

  1. Navigate to Functions tab of a node within the Task in the Design Studio.
  2. Select the User Defined option.
  3. Click the + icon to add the function. Image description
  4. Give an intuitive Name and description for the function.
  5. Select Validation from the Type drop-down. Image description

    Only functions with Validation type are listed in Select function from Jiffy drop-down while adding the Validations.

  6. Click the Save button. Image description
  7. Click the Edit icon to edit the function. Image description
  8. Click the + icon and add the variables as per the requirement. Image description
  9. In the Function definition, write the Python code to check the validation rules. If validation rules not met return an intuitive error message. Image description

    To validate an Email id field, the following Python code is written. Image descriptionIf validation criterion not met, error message ‘Invalid email’ is returned.

Add Validations

You can add the validations for each field in the form.

  1. Click the Validation Image description icon.
  2. Click the ADD NEW button to add the validations. Image description
  3. Select the User-Defined function from the drop-down.
    User-Defined functions of type validations created in the HyperApp will be listed in the drop-down.
  4. Select the Parameter to be passed to the User-Defined Function selected from the drop-down.
    All the columns of the selected table with its inline table columns will be listed in the drop-down. Image description

    Number of parameters to be passed varies based on number of parameters defined in the User-Defined function. E.g if the function selected has two parameters defined then two placeholders will be displayed.

  5. To add more validations, Click the + icon.
  6. Click the Save Button.

Validations are applicable only for Jiffy tables and not for Doc tables.

How Validation Error messages are displayed in the form

Fields in the form are validated as per the business requirement.

If the validation rules set in the user-defined functions are not met for the field, the error messages returned by the functions are displayed under the respective fields on the click of the Save button in the form.

In Customer Detail Form, if Email id is not entered or does not meet the validation rules set in the User-Defined function EmailValidationCheck, the error message 'Invalid Email' returned is displayed under Email field on click of the Save button. Image description

Did you find what you were looking for?