Portal Community

Cancel vs Reset

These two actions are often confused. The distinction is intent and navigation:

ActionWhat it DoesStays on Form?Uses dirty-check?
cancelDiscard changes, navigate awayNo — leaves the formYes (configurable)
resetRestore all fields to initialValuesYes — stays on formNo

Dirty-Check Behaviour

When checkDirty: true (the default), the cancel action checks formEngine.isDirty() before navigating away. If the form is dirty:

  1. A confirmation dialog appears with your configured message
  2. If the user confirms: navigation proceeds, draft is discarded
  3. If the user declines: the dialog closes, the user stays on the form

If the form is not dirty (no changes since last save), the cancel happens immediately with no dialog.

Schema Example

{
  "type": "cancel",
  "label": "Discard",
  "variant": "ghost",
  "icon": "times",
  "order": 0,
  "config": {
    "checkDirty": true,
    "dirtyWarningMessage": "You have unsaved changes. Are you sure you want to leave?",
    "navigateTo": "/dashboard"
  }
}

Navigation on Cancel

The navigateTo config field accepts:

Skipping the Dirty Check

For forms where discarding is always acceptable (read-mostly forms, lookup forms), disable the dirty check:

{
  "type": "cancel",
  "label": "Close",
  "variant": "ghost",
  "config": {
    "checkDirty": false
  }
}
Draft Storage and Cancel The cancel action discards the in-memory form state but does not automatically clear the StorageManager draft. If auto-save has been writing the draft, call storage.clearDraft(formId) in your cancel handler if you want to remove the persisted draft too.