Disable the Submit Button After Click Event

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>
About this Article
  • Created: 07/09/2017 9:06 am EDT
  • Last updated: 07/09/2017 9:11 am EDT
In This Article