cancel
Showing results for 
Search instead for 
Did you mean: 
jasonelia
Nintex Newbie

Redirect URL when user clicks Cancel Button

Jump to solution

Hello -

I know it's possible to redirect users when the form has been submitted to a custom URL, but does any know if it's possible to redirect users when they click the cancel button?  We have a form linked in a central library and would prefer to keep them out of the source list which is what is presented when they cancel the form.

Any suggestions and help will be appreciated.

Thanks!

Jason

Labels: (1)
Reply
17 Replies
Automation Master
Automation Master

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Hi Jason,

You can easily do this by changing the Cancel button into a JavaScript button within its configuration, and writing a small JS function for it to call that redirects to the desired page.

Thanks

View solution in original post

0 Kudos
Reply
jasonelia
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Thanks Mike.  That's actually what we ended up doing after a little more research.  Initially it wasn't obvious to us that we could update the button action, but after we discovered that, we were good to go.

0 Kudos
Reply
Not applicable

Re: Redirect URL when user clicks Cancel Button

Jump to solution

i am new in Nintex form can you give me bit more description of what you have done with this?

0 Kudos
Reply
jasonelia
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Hi Dlyva,

These are the steps we took to accomplish the goal:

Form

  1. Expand the custom JavaScript section in form settings. 
  2. We did something really simple and added the following:  function doRedirect(){history.go(-1);}

Form Settings.png

Cancel Button

  1. For the cancel button behavior, we changed the default button action from Cancel to JavaScript.
  2. In the control settings window for the cancel button we expanded the Advanced section and added the following the Client Click field:  doRedirect();
  3. We saved changes and that did the trick for us. 

Control Settings.png

It's really simply but it let us return the user to the screen previous without worrying where the form link was referenced.  Not sure if there's a better or different way, but I'm sure you can get pretty creative here depending on your requirements.

Cheers,

Jason

Reply
brinad1
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

We are having this same issue, but our users are launching the form from an email that we provide them, therefore the history.go(-1) does not work for us. I tried so many variations of the following JavaScript but none seemed to accomplish what we wanted:

window.location.href = "http://www.Nintex.com";

window.location = "http://www.Nintex.com";

window.location.replace("http://www.Nintex.com");

We ended up using window.top.location.href= "http://www.Nintex.com";

There were two other ways to accomplish this, though, that we discovered during testing. The first was to pass in the query string variable Source=http://www.Nintex.com on the end of our Edit item link in the email, which worked.

We also created a label that had a hyperlink to the redirect page. We put the display name as Cancel and styled it to look like a button.

Hope this helps!

Sabrina

Reply
kmorry19
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

I followed this step but it didn't work for me.... What I found was in my function I had to use a single quote mark rather than double...

eg: function doRedirect(){

window.top.location.href='http://www.Nintex.com');

}

Not sure if anyone else came across the same this but worked once i changed " to '

Thanks for the help!

Reply
courtney_shelto
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Hey Mike,

Is there any way to change this for the Cancel button in the ribbon and/or disable/hide the cancel button in the ribbon? I have the form redirect set to my url (so on save it goes where I want) and I've modified the JS ont he cancel button on the form to redirect to my url (and that works). But if the user clicks the cancel button in the ribbon, it goes to the list AllItems view (save button in ribbon redirects correctly). Any way to address this?

Reply
tphan
Nintex Newbie

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Courtney Vargo‌,

Not sure if you fixed your issue, but I have a pseudo solution you might be interested in.

I have completely hidden the ribbon in all of my forms and have created buttons for the user to press either save / submit buttons or cancel / close, similar to what you mentioned.

You can use the Nintex Form jQuery to hide the cancel button, in your custom form javascript you'll need to add

NWF$('#RibbonCloseButton').hide();

Reply
Not applicable

Re: Redirect URL when user clicks Cancel Button

Jump to solution

Thanks Jason

Reply