AnsweredAssumed Answered

how to wait for Nintex form to submit before redirect

Question asked by oz1er on Dec 2, 2016
Latest reply on Apr 19, 2017 by Enrico Knapp

I am trying to implement this scenario but so far have not been able to. I want to redirect the user to different URLs based on what button they click. I have a save button (to redirect the user to another page) and a save&new button (to submit and present the user with a new form). The two button mentioned above are javascript buttons and reference a hidden save button. In the javascript for the two button I have:
function save_new(){

NWF$('.save').click();

//I need time here for submit to complete - asynchronous

window.location.replace('https://example.com.NewForm...);

}

If I remove the redirect statement it saves - since that statement is not prematurely ending the form submission.

I am also aware that I can use the redirect URL under Advance in the form's settings but my requirement will not be met with that because I need to redirect to two different URLs.

I also read about using custom javascript to prevent the submit default behavior and handle data submission and redirect in the code - but that's way over my head as I am new to javascript.

My question then is if there is another way to achieve this? also is it possible to write a conditional statement in the redirect URL (under the Form Setting - advance) that will take into account which save button is clicked before handing off the url to use in the redirect?

Something like this: if Save1Button=clicked then URL1else if Save2Buttom=clicked then URL2.

Thanks for your input!!

Outcomes