Skip to main content

Field-Level Validation

Field-level validation applies rules to individual components to ensure that the data entered meets specific requirements. These validations are checked when the user attempts to submit the form.

Common Field-Level Validations

  • Required Fields: Mark fields that must be completed
  • Format Validation: Ensure data matches expected formats (email, phone, etc.)
  • Length Validation: Set minimum and maximum character counts
  • Range Validation: Set minimum and maximum numeric values
  • Pattern Validation: Use regular expressions for custom validation

Required Fields

The most basic form of validation is marking a field as required. Required fields must contain a value before the form can be submitted. To make a field required:

  1. Select the component on the canvas
  2. Navigate to the Validation tab in the settings panel
  3. Enable the "Required" option
  4. Optionally, customize the error message that will be displayed if the field is left empty

Format Validation

Certain component types have built-in format validation:

  • Email: Validates that the input is a properly formatted email address
  • Phone Number: Validates that the input matches a phone number pattern
  • URL: Validates that the input is a properly formatted web address
  • Number: Validates that the input is a numeric value

These validations are automatically applied based on the component type.

Length Validation

For text-based components, you can set minimum and maximum length requirements:

  1. Select the component on the canvas
  2. Navigate to the Validation tab in the settings panel
  3. Set the "Minimum Length" and/or "Maximum Length" values
  4. Optionally, customize the error messages

Length validation ensures that text entries are neither too short nor too long.

Range Validation

For numeric components, you can set minimum and maximum value requirements:

  1. Select the component on the canvas
  2. Navigate to the Validation tab in the settings panel
  3. Set the "Minimum Value" and/or "Maximum Value"
  4. Optionally, customize the error messages

Range validation ensures that numeric entries fall within an acceptable range.

Pattern Validation

For advanced validation needs, you can use regular expressions to define custom patterns:

  1. Select the component on the canvas
  2. Navigate to the Validation tab in the settings panel
  3. Enable the "Regular Expression Pattern" option
  4. Enter a regular expression pattern
  5. Customize the error message

Pattern validation is powerful for validating complex formats such as:

  • Postal codes
  • Product codes
  • Custom ID formats
  • Specific text patterns

Unique Validation

The Unique checkbox in the Validation tab enforces that no two submissions of this form share the same value in this field.

note

Unique validation runs server-side on the OSPROV server — not just in the browser. It cannot be bypassed by the submitter. This makes it more reliable than calculated or custom JS validation, which run client-side.

Use Unique for fields that must genuinely differ across all submissions: employee ID, asset serial number, reference code.

Do not tick Unique on fields where many submissions will share the same value (Department, Leave Type) — every second submission would be rejected.

Limitations:

  • Not available on Survey and Location components
  • Not reliable on Multiple Values fields or fields inside a Datagrid

Custom Error Messages

For each validation rule, you can replace OSPROV's default error message with one specific to your form context. See Custom Validation for the full key reference and examples.