Field validation
The field-validation page at /admin/validation/new writes validation for one
column. It can either save a validation directly, or apply a named validation
set to the column — the form decides which based on whether a set name was
entered.
The form
Section titled “The form”The identification fields are:
profile_name— the profile;table_name— the table;data_key— the column.
All three are required. If validation_set_name is non-empty, the submission
calls ApplyValidationSet for that set on the column; otherwise it builds the
validation payload below and calls UpdateFieldValidation.
The validation payload
Section titled “The validation payload”- Character limits —
minimum,maximum, andwarn_at, each a non-negative integer, withcount_modeof characters (default), bytes, or display width. Minimum must not exceed maximum. - Allowed values — a comma-separated
allowed_valueslist, plusallow_emptyandcase_insensitivetoggles. - Display mask —
mask_pattern, withmask_input_char(defaults to#) and an optionalmask_template_char. - Pattern rules — one rule per line in the form
position | constraint. Positions can be a single number, a rangestart-end, a comma-separated list, orstart+for “from here on”. Constraints arealphabetic,numeric,alphanumeric,exact=<text>,one-of=<a,b,c>, orregex=<pattern>. An optionalpattern_descriptionlabels the rule set. - External validation — a toggle for delegating to an external validator.
- Required — a checkbox. The browser sends
required=truewhen checked. - Locked — locks the field’s validation.
The result
Section titled “The result”On success the page reports the backend’s message. A refusal — including a
locally invalid form such as a minimum above a maximum or a malformed pattern
line — is rendered inline with 422 where possible.