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();
});
fSubmit sets some vals then clicks on the real Save button:
function fSubmit() {
// set some field values here
$("input[value='Save']").click();
}
Noticed some quirks so put the following in PreSave:
function PreSaveAction() {
console.log("submitted");
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 () {
fSubmit();
return false;
});
and
$("input[id='kSubmit']").unbind('click').bind('click', function () {
fSubmit();
return false;
});
Suggestions?