Validating Form Data
  • Updated on 09 May 2013
  • 3 minutes to read
  • Print
  • Dark

Validating Form Data

  • Print
  • Dark

One of the most common requirements of an application is to validate form inputs before accepting them. By assigning rules to forms within a flow, the system can validate form data before submission, preventing users from entering invalid information in an application. When the rule returns False , the validation will be enforced.
For example, data entered in an email address field should be in the proper format. A validation rule assigned to the email address field can check the format. If the format is invalid, an error displays when the user attempts to submit the form, and the error must be corrected before the form can be submitted.
Set validation rules for a form in the Form Designer , in the Properties panel, in the Validation Rules section.


Our example flow will illustrate how form data can be validated according to custom rules.

In our example, we will set the Email ID field of the form component to only accept valid email addresses. Start Date will only accept today's date or a date in the future. End Date will only accept dates occurring after today. Our example assumes that our form Leave Request Form has already been created, and is ready to be configured. It also assumes that the rules that will validate the fields have also been created.
Many commonly used validation rules can be found in Root > System > Designers > Catalog > System Defaults > Default Form Validation Rules.
To begin, navigate to a project folder and click the Create Flow button. To add a project folder, select theActions button , then select Add > Designer Project and fill in the name and select OK .

Name the flow and click OK . The form will open. From the Flow Designer's startup window, expand the All Steps > Forms [Interaction] > [Current Folder] category, select the Leave Request Form component and click Add to add it to the workspace.

Connect the form component to the End Step
To assign validation rules to the form, select it and click the Edit Form link at the top of the Properties panel.

In the Properties panel, locate the Rules field under the Custom Validation Rules section. Click Add New to choose a custom rule to add to the form.

To create the rule, enter a name in the Rule Name field. In the Rule drop-down list, navigate to the folder containing the rule and select it. The rule must return False in order for validation to be applied.
Many commonly used validation rules can be found in Root > System > Designers > Catalog > System Defaults > Default Form Validation Rules .

In the Validation Break Text Box , enter the message that will be displayed if the rule is broken.
In the Apply To Controls list, select the checkbox next to each form control that the rule should be applied to.
In the Rule Inputs box, select the input and click Edit [pencil shaped icon].

In the Edit Rule dialog, you can further specify information about the input that the validation rule will check.
To specify that the input will come from a form, from the Input Type drop-down list select Form Component .
To indicate the field on the form that the validation rule should check, select it from the  Form Data Name drop-down list.

Click OK to save the changes and close this pop-up, then click OK on the Add Validation Rules dialog to save the validation rule. 
You can follow this process to add two more validation rules.
Add a validation rule to check that the Start Date is the current date or a date in the future.

Finally, add a validation rule to check that the End Date follows the Start Date.

If you have completed configuring the form, save the form and close the Form Designer .
The flow is also finished, save the flow and close theFlow Designer .
To see the flow in action, click the Action link in the new flow's thumbnail and select Run Flow .

Enter an email address in an invalid format and click OK. An exclamation mark displays next to the field and the OK button, and a message appears with the text we entered in the Validation Break Text Box.


When you enter invalid dates and click OK , the validation rules check the data, and the error message displays.

Was this article helpful?