Skip to content

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 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.

  • Character limitsminimum, maximum, and warn_at, each a non-negative integer, with count_mode of characters (default), bytes, or display width. Minimum must not exceed maximum.
  • Allowed values — a comma-separated allowed_values list, plus allow_empty and case_insensitive toggles.
  • Display maskmask_pattern, with mask_input_char (defaults to #) and an optional mask_template_char.
  • Pattern rules — one rule per line in the form position | constraint. Positions can be a single number, a range start-end, a comma-separated list, or start+ for “from here on”. Constraints are alphabetic, numeric, alphanumeric, exact=<text>, one-of=<a,b,c>, or regex=<pattern>. An optional pattern_description labels the rule set.
  • External validation — a toggle for delegating to an external validator.
  • Required — a checkbox. The browser sends required=true when checked.
  • Locked — locks the field’s validation.

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.