Genpact Cora Knowledge Center


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');
    window.onbeforeunload = DisableButton;