☁️ Loving our new documentation website? Provide feedback in the CloudCannon Community! ✨

pattern_message

Table of contents

Description:

This key defines a custom error message that explains why a value has failed the validation criteria from options.pattern.

This key requires you to define options.pattern.

This key has no default.

This key is available for Code, Color, File, Select, Text, Rich Text, and URL Inputs.

Appears in:
└── _inputs
    └── *
        ├── Text Input
        │   └── options
        │       └── pattern_message
        ├── Textarea Input
        │   └── options
        │       └── pattern_message
        ├── Code Input
        │   └── options
        │       └── pattern_message
        ├── Color Input
        │   └── options
        │       └── pattern_message
        ├── Rich Text Input
        │   └── options
        │       └── pattern_message
        ├── File Input
        │   └── options
        │       └── pattern_message
        ├── URL Input
        │   └── options
        │       └── pattern_message
        ├── Select Input
        │   └── options
        │       └── pattern_message
        └── Choice Input
            └── options
                └── pattern_message
Type:
string
Examples:

In this example, we prompt our team to use the correct email format in the contact_email Input using a pattern message.

Copied to clipboard
_inputs:
  contact_email:
    type: email
    options:
      pattern: '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}'
      pattern_message: Please use the format ___@___.__
{
  "_inputs": {
    "contact_email": {
      "type": "email",
      "options": {
        "pattern": "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}",
        "pattern_message": "Please use the format ___@___.__"
      }
    }
  }
}
Open in a new tab