Skip to content

Validation

Forms validate with form.validate(data), which walks nested layouts and applies string rules and callables.

from almasix.orbit.forms import Form, TextInput
form = Form.make().schema([
TextInput.make("email").required().email().unique("users", "email"),
TextInput.make("password").required().confirmed(),
TextInput.make("password_confirmation").required(),
])
errors = form.validate({"email": "a", "password": "x", "password_confirmation": "y"})

Register database hooks with Form.unique_using(...) / Form.exists_using(...).

See the Forms overview for the full rule catalog. Field helpers: .unique(), .exists(), .regex(), .between(), .validation_attribute(), .validation_messages({…}).