onSubmit
onSubmit Client Scripts execute whenever the user saves the form, whether they click Save, Submit, or Update.
It's important to understand that any asynchronous code in an onSubmit Client Script runs the risk of not executing, as the form may reload before it has a chance to receive a response from the server! For this reason, any necessary queries or other server requests, should be performed synchronously in an onSubmit script. This is nearly the only situation in which you should intentionally run scripts synchronously in a client-side script.
Additionally, onSubmit Client Scripts have the benefit of being able to tacitly allow or prevent submission before the data is sent to the server, by simply returning a boolean true or false. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access