fd.onsubmit with confirm
I'm getting the confirmation popping up twice with the code below -- any ideas for a workaround?
fd.onsubmit(function() {
if (fd.field('PROJECT_ApprovalWF_Comments').value() == '') {
alert('Please add a comment when rejecting.');
return false;
} else if (confirm("To reject this PROJECT and immediately end the approval process without requesting any changes click OK, otherwise click Cancel and choose the Send back option to request changes and restart approval.")) {
fd.field('PROJECT_ApprovalWF_Outcome').value('Reject');
fd.field('PercentComplete').value(100);
fd.field('Status').value('Completed');
fd.field('PROJECT_x0020_Approved_x0020_By').value(_spPageContextInfo.userLoginName);
return true;} else {return false;}
});
fd.onsubmit(function() {
if (fd.field('PROJECT_ApprovalWF_Comments').value() == '') {
alert('Please add a comment when rejecting.');
return false;
} else if (confirm("To reject this PROJECT and immediately end the approval process without requesting any changes click OK, otherwise click Cancel and choose the Send back option to request changes and restart approval.")) {
fd.field('PROJECT_ApprovalWF_Outcome').value('Reject');
fd.field('PercentComplete').value(100);
fd.field('Status').value('Completed');
fd.field('PROJECT_x0020_Approved_x0020_By').value(_spPageContextInfo.userLoginName);
return true;} else {return false;}
});
-
- Moderator
- Posts: 33
- Joined: Wed Sep 21, 2016
Hi!
Check, please, if you defined "onsubmit"-function on Submit-button(or any buttons) and in "Javascript" too. Or just added handler in "Javascript" twice.
Check, please, if you defined "onsubmit"-function on Submit-button(or any buttons) and in "Javascript" too. Or just added handler in "Javascript" twice.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
We've just supposed that you added the same handler twice and as a result you're gettings the confirmation twice.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests