Hi
I am attempting to stop the service activity form from submitting. I have created this small javascript method that is executed on form save. The last line of the method confirms that the save event has been prevented. However, the form still submits. Is it not possible to prevent form submission on service activities or am I doing something wrong?
function save(context) { var saveEvent = context.getEventArgs(); saveEvent.preventDefault(); console.log(saveEvent.isDefaultPrevented()); }
*This post is locked for comments
HI
Please try below code if it might help:
function (econtext) {
var eventArgs = econtext.getEventArgs();
if (eventArgs.getSaveMode() == 70 //autosave
|| eventArgs.getSaveMode() == 1) //manual save or Xrm save
{
//Prevent auto/manual save
eventArgs.preventDefault();
}
}
thanks !
Unfortunately the issue still seems to exists after a function name change?
Context is already been passed through to the method and isPreventDefault() is returning a value.
Hello,
Haven't faced similar issues but try to change name of function to something not-so standard (and potentially system name) like:
function myOnSaveHandler(){
//...
}
HI ,
Please check if ur selecting ''Pass execution context * as shown in below link:
neilparkhurst.com/.../javascript-prevent-save
Thanks !
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156