Validating input in forms

Ensure that the user input on a form meets the required conditions before the case moves to the next step in the life cycle. For example, you can ensure that a customer name and address are provided before a customer places an order.

You define validation conditions to check whether the user input on the form is incorrect. If the user input matches the validation parameters, an error message appears when the user tries to submit the form.

Before you begin: Create a case type, and then define a case life cycle that has stages and processes with assignments. The forms in your assignments must have fields that you want to validate. For more information, see Designing a case.
  1. In the navigation panel of Dev Studio, click Case types.
  2. On the Workflow tab, click Life cycle.
  3. Select the step for which you want to apply the validation condition.
  4. In the Step pane on the right, on the General tab, click Configure view.
  5. Optional: To ensure that the user enters a value in a field before submitting the form, set the field as required:
    1. In the view configuration window, on the Fields tab, locate the field that you want to set as required.
    2. In the Options list for that field, select Required.
      When the user tries to submit the form without a value in a required field, an error message appears.
    For example: Set the birth date field as required to prevent the user from submitting a form without entering the date of birth.
  6. In the view configuration window, on the Validations tab, click Add condition.
  7. Optional: To display an error message when the validation fails, in the Message field, enter the text of the message.
  8. Define the validation conditions for a field on the form:
    1. From the list of fields, select the name of a field that you want to validate.
    2. From the comparator list, select a test that you want to perform on the field.
    3. In the value field, enter a value to compare against the user input.
      You can compare the user input against other fields in the form by clicking Select values, and then selecting another field from your form that you want to use as a validation value.
    For example: To ensure that the birth date is not set in the future, select the birth date field from the list, set the is after comparator, and then select Today from the calendar control. When the user tries to submit the form with a birth date that is set in the future, an error message appears.
  9. Optional: To create a condition with multiple validation parameters, add a logical operator to the condition:
    Option Description
    AND Ensure that the condition passes when all properties meet the defined criteria:
    1. Click the Add a row icon.
    2. Select and from the operator list.
    3. Define the validation conditions by configuring the fields as in step 9.
    OR Ensure that the condition passes when either property meets the defined criteria:
    1. Click the Add a row icon.
    2. Select or from the operator list.
    3. Define the validation conditions by configuring the fields as in step 9.
    For example: In a recruitment form, the user must indicate the time of employment in a specific company by entering dates in the From and To date type fields. You can configure a validation condition with the AND logical operator that ensures that the starting date is before the end date, and that the end date is after the starting date.

    Figure: Validation for the date range of employment

    Validation condition with an error message that appears when the user tries to submit a date range that has a From date set after the To date, and the To date set before the From date.
  10. Optional: To define more validation conditions, repeat steps 6 through 9.
  11. Click Submit.
Result: At run time, the application evaluates all validation conditions. If any condition fails, an error message appears, and the form is not submitted until the user corrects the invalid fields.