Wit Form
Patterns

Edit a Record

Change something and the Save button turns on. Discard puts the loaded values back. Turn on “Fail the next save” to see a failed save keep your edits.

Notifications
All changes saved

What this shows

Load a record, edit it and save it. See Loading and Saving Data.

  • resetInitialValues(record) loads fetched data as the new initial values.
  • useIsDirty() enables Save only when something changed, and handleReset() discards the edits.
  • When the save fails, onSubmit resolves to false, so the initial values are kept and the edits stay.
  • checkIsDirty() asks before switching to another record.

On this page