former

The form pipeline — fill, dirty guard, save, field errors

The pipeline — fill, edit, save (live; try ana@taken.com)

The rules

  • ONE call: g.former(form, { endpoint, refresh, guard: true, toast }) — it owns submit (after the validator passes), collects values, posts, shows the toast and refreshes the lister you point it at.
  • fill(row) loads a record for editing; fill(null) resets to the authored defaults (the "new" state) — ONE form serves create and edit.
  • guard: true = the dirty guard: navigating away from unsaved edits asks first. Use it on every editing form.
  • A refused save with data.fields lands each message on ITS field — server validation looks exactly like client validation.
  • The button row follows the standard (forms): the form wraps body + .card-footer, the buttons sit RIGHT-aligned there, primary last.
  • In modals, former pairs with the modal open/close (see the data-list page); the wizard rides former for multi-step (wizard).
  • Docs: templates/app/docs/libs/former.md; the harness: /tests/former.