Will_Iam
Design Dabbler

Prevent from Navigating Away from the Form

Jump to solution

Hello,

 

I'm trying to add a prompt warning window in Nintex warning users of losing their form data if a user accidentally presses the back button on the browser or clicks on a side navigation bar.

 

I've found the code online using Javascript

 

window.onbeforeunload = function() {
  return "Are you sure you want to navigate away?";
}

My question is how would I incorporate this into Nintex?

 

Thank you.

0 Kudos
Reply
3 Replies
eharris04
Workflow Hero

Re: Prevent from Navigating Away from the Form

Jump to solution

@Will_Iam within the Nintex form designer you can embed javascript into the form settings or on a control. I am not sure you can do that on submit, but there is an option to do that via client click.

 

image.png

 

0 Kudos
Reply
Will_Iam
Design Dabbler

Re: Prevent from Navigating Away from the Form

Jump to solution

I figured out the solution.

Add the following to the Javascript section in form settings:

 

NWF$(document).ready(function(){  

 window.onbeforeunload = function() {
 return "Are you sure you want to navigate away?";
} });

 

 

A confirmation will pop up when you submit the form as well.  To make that an exception add the following to Client click section of the button:

 

window.onbeforeunload = null;

 

 

View solution in original post

Reply
thesturl
Canvas Initiate

Re: Prevent from Navigating Away from the Form

Jump to solution
This is exactly what I was looking for. Thanks for posting!
0 Kudos
Reply