Scripts and functions defined here will always be executed if the user leaves the dialog, regardless whether the step was send or not.
General Settings If you have enabled "Confirmation check when exiting steps" in General Settings | JobRouter Configuration you can disable the change notifications for a dialog with the return of the value false from the context of a function for this dialog.
Of course, you can also use JavaScript API functions here, such as jr_disable_dialog_changecheck() and jr_enable_dialog_changecheck() to influence the displayed confirmation prompt.