Adds an event handler that runs just before a save.
The onBeforeSave()
function allows you to optionally perform actions
right before a save()
operation. When you call save()
, the
callback is run before the save operation. Any validity checks on the
data are run after the callback runs. If the callback function
returns false
, returns a rejected Promise, or throws an error, the
save operation is canceled.
Notes:
onBeforeSave()
on a read-only dataset causes an error.onBeforeSave()
runs before any input element validations.
handler(): Promise<boolean> | boolean The before save event handler.