Disable "Leave Site?" pop up when leaving form

mdjoseph12
Giga Contributor

I have an onchange redirect that is triggered when a user selects a specific value from a list. Recently a popup began appearing that asks if the user is sure they want to leave. I've tried using g_form.modified but it hasn't had an effect on the issue.  Does anyone have any recommendations? I've also tried disabling this sys property glide.ui.dirty_form_suppor

1 ACCEPTED SOLUTION

Give this a try.

g_form.clearValue('impact');
g_form.clearValue('comments');
g_form.clearValue('category');
top.window.onbeforeunload = null;
top.window.onunload = null;
top.window.location = 'YOUR URL HERE';

View solution in original post

6 REPLIES 6

The Machine
Kilo Sage

Is this on a catalog item (form) or record?  Basically you would need to find what fields were modified and clear the values before the redirect.  This will prevent the message.

If you want to keep the values (for example on a record), you can try g_form.save() before the redirect which should also prevent the message from coming up.

Hope that helps.

Unfortunately, I'm still getting the pop up even after clearing the values as seem below: 

g_form.clearValue('caller_id');
g_form.clearValue('short_description');
g_form.clearValue('category');
g_form.clearValue('description');
g_form.clearValue('contextual_search_results');
			
top.window.location = "/help?id=help_sc_cat_item&sys_id=dd46bcc313f7ab00a757fa82e144b0b5";

Give this a try.

g_form.clearValue('impact');
g_form.clearValue('comments');
g_form.clearValue('category');
top.window.onbeforeunload = null;
top.window.onunload = null;
top.window.location = 'YOUR URL HERE';

Worked! Thanks!