Skip to content

Validate

The Validate node checks input fields against a list of validation rules. If any rule fails, it returns an error object with _valid: false and a list of error messages. If all rules pass, the input flows through unchanged.

Configuration

PropertyTypeDefaultDescription
rulesarray[]Required. An array of validation rule objects.

Each rule object has:

PropertyTypeDescription
fieldstringThe field name to validate.
rulestringThe validation rule type.
valuestringThe rule parameter (used by some rule types).

Validation Rule Types

RuleValueDescription
required--Field must not be null, empty string, or empty array.
min_lengthnumberString must be at least this many characters.
max_lengthnumberString must be at most this many characters.
email--Must be a valid email address (uses FILTER_VALIDATE_EMAIL).
numeric--Must be a numeric value.
minnumberNumeric value must be at least this amount.
maxnumberNumeric value must be at most this amount.
regexpatternMust match the given regular expression pattern (without delimiters).

Input

Accepts a single object or an array of rows. When an array is provided, only the first row is validated.

Output

Validation passes

Returns the input data unchanged.

Validation fails

Returns an error object:

json
{
  "_valid": false,
  "_errors": [
    { "field": "email", "message": "email must be a valid email" },
    { "field": "name", "message": "name is required" }
  ]
}

The frontend form system automatically displays these errors next to the corresponding form fields.

Example Rule Configurations

Contact form validation

json
[
  { "field": "name", "rule": "required" },
  { "field": "name", "rule": "min_length", "value": "2" },
  { "field": "email", "rule": "required" },
  { "field": "email", "rule": "email" },
  { "field": "message", "rule": "required" },
  { "field": "message", "rule": "min_length", "value": "10" }
]

Numeric range validation

json
[
  { "field": "quantity", "rule": "required" },
  { "field": "quantity", "rule": "numeric" },
  { "field": "quantity", "rule": "min", "value": "1" },
  { "field": "quantity", "rule": "max", "value": "100" }
]

Pattern-based validation

json
[
  { "field": "phone", "rule": "regex", "value": "^\\+?[0-9\\s\\-]{7,15}$" },
  { "field": "username", "rule": "regex", "value": "^[a-zA-Z0-9_]{3,20}$" }
]

Example Use Case

Form submission pipeline

Context --> Validate --> Sanitize --> Save Row --> Send Email --> Output

If validation fails, the pipeline returns the _valid: false response immediately. The form displays errors, and no data is saved or emailed.

TIP

Always pair Validate with Sanitize in form submission pipelines. Validate checks correctness; Sanitize cleans the data before storage.

WARNING

Validation runs server-side and cannot be bypassed by manipulating the frontend. This is a security feature -- always validate user input in the pipeline, even if you also validate on the client.