Shared capabilities / Validation

Let people edit.
Protect accepted data.

An invalid value stays in the field, where it can be corrected. The Data Bag keeps the last valid value until the next edit passes validation.

One pipeline across the inputs

A clear rule.
A visible result.

Required values, lengths, typed ranges and custom checks belong to the field declaration.

  • The rejected draft remains visible and the field is highlighted.
  • A floating message explains the error without moving the surrounding layout, then fades away.
  • Warnings can advise without blocking acceptance.
  • Asynchronous results are checked against the current edit; stale replies do not overwrite newer work.

Validation guides the native controls where applicable. It also handles behavior that browser constraints alone do not cover.

Real validation example: a one-letter name is rejected and highlighted while other form fields remain aligned.
Actual Python gallery, w25. A GroupBox contains a Formlet and several widget types.

Available now

From a required field
to an endpoint check.

Required values & length

validate_notnull and validate_len enforce presence and text length. Zero and false remain valid values.

Ranges & patterns

Minimum and maximum checks respect numeric and temporal types, including exact Decimals. Regex and email-shape checks cover text patterns; an email check does not prove an address exists.

Transformations & defaults

Normalize case or replace an empty candidate with an explicit fallback before accepting it.

Conditional rules & warnings

Enable rules based on other resolved inputs. Supply messages and choose whether a rule advises or rejects.

Local callbacks

validate_call invokes browser Logic, including Promise-returning methods. Acceptance and rejection callbacks can react to the outcome.

Asynchronous endpoint checks

validate_remote uses the existing typed RPC path to a Page endpoint. Requests are asynchronous, with timeouts and stale-reply handling; no synchronous browser request is needed.

Browser validation is not a server security boundary. A real backend must enforce its own authorization and data constraints. Database existence, duplicate-record and grid-duplicate validators belong to the future DB/grid work; they are not part of this collection yet.

Read it in the declaration

The rules travel
with the field.

The same component grammar is available to Python and JavaScript authors.

PYTHON · REAL PLAYGROUND EXCERPTS
fields.numberTextBox(
    value="^.quantity",
    lbl="Quantity: 0–10",
    validate_min=0, validate_max=10
)

fields.textbox(
    value="^.remote_name",
    lbl="Remote name",
    validate_remote="check_name",
    validate_timeout=5000
)

CONTINUE HERE

Put validation into a complete story.