onBeforeSave( )

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.


  • Calling onBeforeSave() on a read-only dataset causes an error.
  • onBeforeSave() runs before any input element validations.
Method Declaration
Method Parameters

handler(): Promise<boolean> The before save event handler.

Was this helpful?