Validation Rules Tab

Form validation is the process of setting conditions, known as validation rules, on Form fields to govern the acceptable data that can be submitted with the Form. These validation rules are tested when the form is submitted, to ensure the data in the Form fields meet the desired conditions. If the data in a form field fails to meet the requirements of a validation rule, the form won't be submitted. Instead, the form will reload and the appropriate validation errors will be displayed. Validation error messages should tell the user why the Form failed to submit and, ideally, how to correct the validation error.

Some validation rules are built into Process Director. For instance, setting a Form field to be required will cause a validation error to occur if you try to submit the Form without adding a value to the required field. The Validation Rules tab enables you to create you own custom validation rules, and provide the appropriate validation error messages.

By clicking on the Add Validation Rule button you can add your own validation rule. You can create a condition under which each validation rule will run. If that condition is met—or, not met, as you desire—you can display a custom validation error message.

Some special considerations apply when using validation rules to validate fields in an array. Process Director uses slightly different logic for array validation, and that logic may change depending upon the operator used to validate the array values. In the examples below, there are a number of possible validation rules to assist you in understanding the logic used when validating arrays. In these examples, an array field will be designated as an array column with the name of Col1, Col2 etc., while non-array fields will be designated as Field1, Field2, etc.

Some general rules need to be addressed first, though. Any time you create a validation rule, you are evaluating a value on the left side of the operator with a value on the right side of the operator. Process Director will respond differently depending on whether you are trying to compare a non-array field with an array field, on what side of the operator the array field is used, or whether you are comparing two array fields.

Comparing Non-Array and Array fields

The way process Director compares array fields with non-array fields is different, based on whether the array is on the left or right side of the operator.

  • If the right side of the operator is an array column, the evaluation will occur against a comma-separated list of all values in the column, e.g., "1,2,3".
  • If the left side is an array column field and the right side is a non-array field, the evaluation will occur for the column field for EACH row, and each condition is tested against the field value.

Let's assume we have an array field, named Col1, containing three rows, with the following values:

  • Row 1: a
  • Row 2: b
  • Row 3: c

Let's also assume that we have a non-array field called Field1, with a value of "b".

If we want to do a comparison with Field1 on the left side of the operator and Col1 on the right side, Process Director will return the value of Field1 as "b", and Col1 as "a, b, c". As a result, some operators will generally not work. In general, Field1 = Col1 (b = a, b, c), will generally return "false", while Field1 <> Col1 (b <> a, b, c) will generally return "true". Similarly, Field1 Contains Col1 will generally return "false". On the other hand, Field1 In Col1 will validate properly, because "b" is in "a, b, c".

Notice the liberal use of the word "generally" in the preceding paragraph. You can make comparisons using the "=" or "<>" operators if the non-array field contains comma-separated values. For instance, if you put the value "a, b, c" in Field1, then Field1 = Col1 will return true, because "a, b, c" = "a, b, c". You're essentially comparing two comma-separated lists that both have the same value. (Actually, you need to be sure to put spaces between the values in Field1, because "a,b,c" won't validate, though "a, b, c" will.)

The logic for comparisons works differently if the array field is on the left side of the operator, and the non-array field is on the right. In that case, process Director will parse each array row for the comparison, which will provide the following results:

VALIDATION RULE FIELD VALUES DESCRIPTION
Col1 In Field1

Col1:
X
2
Y

Field1: 2

Is true if ANY row in Col1 is IN Field1. For example, this is “true” because col1 (row2) is in Field1
Col1 Not In Field1

Col1:
2
3
2

Field1 = 2

Is true if ANY row in col1 is IN NOT IN FIELD1. For example, this is “true” because col1 (row2) is NOT in Field1
Col1 Contains Field1

Col1:
1
22
3

Field1 = 2

Is true if ANY row in col1 contains FIELD1. For example, this is “true” because col1 (row2) contains Field1. In this case "22" contain "2"

NOTE: This is a text comparison NOT a numeric comparison.

Col1 Does Not Contain Field1

Col1:
2
3
2

Field1 = 2

Is true if ANY row in col1 doesn't contain FIELD1. For example, this is “true” because col1 (row2) doesn't contain Field1

Comparing Array Fields

Comparing two array columns works quite differently. In general, Process Director will compare the values in each row in the array. The operators for array comparisons will work in the following manner.

OPERATOR COLUMN VALUES DESCRIPTION
Col1 In Col2
Col1 Col2
1 2
2 X
3 Y
Is true if ANY value in Col1 is in ANY row of Col2. For example, this is “true” because the value in Col1/Row2 is in Col2/Row1
Col1 Not In Col2
Col1 Col2
1 3
X 2
3 1
Is true if ANY value in Col1 is NOT IN in ANY row of Col2. For example, this is “true” because the value in Col1/Row2 isn't in Col2.
Col1 = Col2
Col1 Col2
1 1
2 X
3 Y
Is true if ANY value in Col1 equals the value in Col2 in the SAME Row. For example, this is “true” because Col1=Col2 in Row 1.
Col1 <> Col2
Col1 Col2
1 1
2 X
3 3
Is true if any value in Col1 isn't the same as the value in Col2 in the SAME Row. For example, this is “true” because Col1 <> Col2 in Row 2.
Col1 Contains Col2
Col1 Col2
1 X
X2 2
3 Y
Is true if any value in Col1 contains the value in Col2 in the SAME Row. For example, this is “true” because Col1 contains Col2 in Row 2. Again, keep in mind that this is a text comparison.
Col1 Does Not Contain Col2
Col1 Col2
1 1
2 X
3 3
Is true if any value in Col1 doesn't contain the value in Col2 in the SAME Row. For example, this is “true” because Col1 doesn't contain Col2 in Row 2

More Configuration Tabs

You can view the documentation for each of the other configuration tabs by using the Table of Contents displayed on the upper right corner of the page, or use one of the links below.

Properties: General Form definition properties.

Edit: Opens the editor for the form's visual template, the Online Form Designer.

Form Controls: Enables you to set individual properties for each field on the form.

Custom Task Event Mapping: Enables you to map Custom Tasks to run on specified form events.

Set Form Data: Enables you to set the value of Form fields automatically, based on events or conditions you specify.

Fill Dropdowns: Enables you to automatically set the options available in a dropdown control.

Other Tabs: Documentation for the Form Data SQL View, History, Meta Data, Versions, and Permissions tabs.