DocsSchemas · FRL
On this page

Validate text and numbers

Constrain strings, enum values and numbers.

Before you begin: Choose field access and references.

String Rules

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

RuleMeaning
requiredValue must not be undefined or null.
minMinimum string length.
maxMaximum string length.
patternA regular expression string, or a segmented pattern object for structured values.

Use a regex string when a value belongs in one input. Use { segments, separator } when the value has meaningful parts, such as a card expiry, serial number, or grouped identifier. Each segment requires its own pattern and can include a user-facing name and placeholder. Frontbacked validates every segment and the literal separator, and admin forms can present the parts as dedicated inputs without guessing what a regex means.

Segment patterns validate one complete segment. The separator stays outside the segment patterns and is stored as part of the final string, so the example above stores 12/30.

Use type: "phone" for phone numbers. Frontbacked accepts common formatting such as spaces, dashes, and parentheses, normalizes the value, and requires a valid international number with a country code.

Enum Fields

Use type: "enum" when a field must be one of a few named options.

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Enum values are saved as strings, so FQL reads them normally:

index.html

Inside FRL, $this.fields exposes the enum values without repeating string literals:

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Use hasEnum(value) when a rule needs to check whether a value belongs to that field's enum list:

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

Enum rules:

RuleMeaning
requiredValue must be present.
enumsAllowed string values.
defaultValue to use on create when the field is missing or null.

Number Rules

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

RuleMeaning
requiredValue must be present.
minMinimum numeric value.
maxMaximum numeric value.

Continue with Validate objects and arrays.