My custom button is triggering events twice.

Custom button is in a content editor web part. It is supposed to set some fields value unique to submitting, then call the normal save function. Below is my setup.

Wiring up my Submit button (different than Save) to call fSubmit:

var bSubmit = $("input[id='kSubmit']");
  bSubmit.click(function () {

fSubmit sets some vals then clicks on the real Save button:

function fSubmit() {
      // set some field values here

Noticed some quirks so put the following in PreSave:

function PreSaveAction() {
return false;

In the console I can see my custom submit action is firing twice with each click.

Tried a few variations, no luck, still firing twice...

$("input[id='kSubmit']").on('click', function () {
  return false;


$("input[id='kSubmit']").unbind('click').bind('click', function () {
  return false;


  • Try to use Script editor web part instead of CEWP – Raf May 13 '19 at 4:23
  • @BDC604 Are you clicking the Save button of New/Edit form as well? – Sohail Shaikh May 13 '19 at 5:43

I overlooked that there are 2 save buttons; one on the form and one on the ribbon. This javascript is effectively clicking both. To resolve, I changed the code as below.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.