The submit() method starts the Server part of the event, when the basic routine can not be used.
When the Client Before part of the Custom button event runs an asynchronous task (for example, displaying a dialog and waiting for the user's answer, or creating a PDF file), the event must return false. Otherwise the Server part runs immediately, before the asynchronous task ends.
Call the submit() function after the asynchronous task has finished to pass control to the Server event.
No return value.
Postpone the Server event for five seconds.
A more complete examples that uses Sweetalert confirmation dialog. We are adding this code to custom button's ClientBefore event. We want to proceed with the Server action only if "Yes, please" button was clicked. In order to do so we return false; at the end of ClientBefore event and in the code branch that handles "Yes, please" button click we issue submit() call.