Expand description
Admin-new form engine.
Turn a FormConfig of FieldConfigs into drawer-based form
HTML. Every input type routes through a dedicated renderer that
uses only classnames present in the approved components.css —
no new classes, no new styles, no JS, no filesystem, no DB.
The ForeignKey rule is load-bearing: FK fields always render
as a <select> populated from FieldConfig::options. Raw numeric
row ids are never presented to the admin user; the caller resolves
(value, label) pairs upstream and passes human-readable labels in.
UI-level validation lives here too: validate_form walks the
fields, applies a small set of basic rules (required / email /
number), and writes any failure into FieldConfig::error. The
renderers add class="invalid" to the input and append a
.field-error block below — both classes are referenced but not
styled here; styling is assumed to live in the bundled CSS.
Structs§
Enums§
Functions§
- bind_
form - Pull submitted values out of a parsed urlencoded body and write them into the form’s fields.
- infer_
field_ type - Infer a likely
FieldTypefrom a field name. - render_
error - Render the
.field-errorblock for a single message. Emptymsg→ empty string, so callers don’t need to gate the call. - render_
field - render_
form - validate_
form - Walk the form’s fields and apply the basic validation rules: