You can disable the Submit button and Save button on page unload. This is helpful when you want to prevent double-click, which triggers a Failed to save data error message, and creating duplicate records in a UACT table.
Add the following script to the form's markup.
btnSubmit is the ID of the Submit button.
<script type="text/javascript">
function getElementById1(id) {
var obj = $find($sq('[id$=' + id + ']').attr('id'));
if (obj == null)
{
obj = $get($sq('[id$=' + id + ']').attr('id'));
}
return obj;
}
function DisableButton() {
var btn=getElementById1('btnSubmit');
btn.set_enabled(false);
}
window.onbeforeunload = DisableButton;
</script>