Cancel button
Discards unsaved changes and returns to the prior page, with a confirmation prompt if the form is dirty.
The Cancel button discards unsaved changes and navigates away. If the form has unsaved edits, the user is prompted to confirm before leaving. Pairs with
Submit, or use SubmitCancel for the standard side-by-side layout.
Properties
| Property | Description |
|---|---|
labelstring default: Cancel | Button caption. |
buttonAlign'left' | 'center' | 'right' default: left | Horizontal alignment within the cell. Maps to text-align for the solo button. |
JavaScript recipes
Run cleanup when the form is dismissed
f365.events.onCancel(() => {
f365.ui.showToast('Edit discarded');
});
Close the form from your own button
// closeForm() bridges to the SPFx Form Customizer host (back to the list);
// on the web part / demo host it fires onCancel instead.
f365.nav.closeForm();
Confirm before abandoning a dirty form
f365.events.onCancel(async () => {
const ok = await f365.ui.showConfirm('Discard your changes and leave?');
if (ok) f365.nav.goBack();
});
Related
Related articles
- Submit button
The form's primary action button, triggers validation, the save flow, and any onBeforeSave / onSave handlers.
- SubmitCancel pair
The conventional "Submit + Cancel" button pair at the bottom of a form, paired layout with the right spacing built in.