Skip to content

Form Validation Settings ​

The purpose of validation settings is to ensure that the data collected through the forms meet your standards for quality and consistency.

Validation Policies (behavior) ​

We have implemented three distinct validation policies that determine how the system processes incoming form submissions:

  • Do Not Validate: This policy is the most lenient, allowing all submissions to pass through without any checks. This might be suitable for forms where data validation is not critical or will be performed on client side.

  • Accept and Mark: With this policy, the system checks submissions against the specified validation rules. If a submission fails to meet these criteria, it is still stored but is flagged as 'Invalid'. This approach is useful when it is important to capture all attempts at submission, regardless of their validity. In this case validation errors will be attached to submission's metadata.

  • Do Not Accept: This is the strictest policy, wherein any submission that fails to pass the validation rules is outright rejected and not stored. This ensures that only data which meets all requirements is collected. In this case validation errors will be returned in submission response.

Validation Rules ​

Validation rules are specific criteria that submissions must meet to be considered valid. Here you can set up field type (text | number | email | date) which is additional check for input type. Also, you can set up max and min input value characters count (for text types) or max and min numeric value (for number type) and mark the field as mandatory (required)

Message field is optional, here you can set a common message which will be returned to the client if some validation checks fails for the field. By default, we return a specific message for each check.

Default validation messages ​

RuleMessage
requiredThe :attribute field is required.
emailThe :attribute must be a valid email address.
textThe :attribute must be a string.
min:nThe :attribute must be at least :min characters.
max:nThe :attribute may not be greater than :max characters.
numericThe :attribute must be a number.
dateThe :attribute is not a valid date.

Managing Rules ​

  • To add a rule, select the 'Add Rule' button which will prompt you to define a new set of criteria.
  • To remove a rule, click on the 'Remove Rule' icon next to the rule that is no longer needed.

Rules Examples ​

Example Rule 1: User Name ​

  • Field Name: user_name
  • Field Type: Text
  • Min Length: 3 characters to ensure a basic level of detail.
  • Max Length: 50 characters to prevent excessively long names.
  • Message: "User name must be between 3 to 50 characters."
  • Required: Yes, this field cannot be left blank as user identification is essential.

Example Rule 2: Email Address ​

  • Field Name: email_address
  • Field Type: Email
  • Min Length: Not applicable, as the email format is being validated instead, so leaving it blank.
  • Max Length: 100 characters to accommodate a wide range of email addresses.
  • Message: (blank)
  • Required: Yes, the email address is crucial for communication purposes.

Example Rule 3: Feedback Comment ​

  • Field Name: feedback_comment
  • Field Type: Textarea
  • Min Length: 10 characters to encourage meaningful feedback.
  • Max Length: 500 characters to maintain conciseness.
  • Message: "Feedback must be 10-500 characters in length."
  • Required: No, users may choose not to provide feedback.

Response Examples ​

json
{
  "status": 422,
  "error": "Validation Failed",
  "message": "Error",
  "data": {
    "user_name": [
      {
        "required": "User name must be between 3 to 50 characters"
      }
    ],
    "email": [
      {
        "email": "The email address must be a valid email address."
      }
    ],
    "feedback_comment": [
      {
        "max": "Feedback must be 10-500 characters in length."
      }
    ]
  }
}