yera.dsl.forms
Present structs as forms and collect validated submissions.
Symbols
present_form
present_form(
model_type: type[ModelT],
label: str | None = None,
cancel_label: str | None = None,
) → ModelT | NoneCollect a validated instance of a model through a form.
Rejected submissions are echoed with their errors and the form is presented again, pre-filled with the submitted values and secrets masked, until a submission validates or the user cancels.
Parameters
model_type
type: type[ModelT]
Model or struct class whose fields the form presents.
label
type: str | None = None
Optional question shown above the form.
cancel_label
type: str | None = None
Optional label for an action that returns None
without validating the form.
Returns
type: ModelT | None
The validated instance, or None when cancellation is enabled and selected.