Return to search results when closing Nintex form

  • 1 March 2017
  • 1 reply
  • 17 views

Badge +3

I have a search page which is returning results from a list with a Nintex form.

When the user opens an item from the search results and then closes it, she is returned to the default view of the list or whatever is specified in the Redirect URL layout setting.

Is there a way to make Nintex return to the search results page? (except from introducing a close-button which navigates back in the browser)


1 reply

Badge +8

Hi Hans-Henrik Sørensen‌,

How are you closing the open Nintex form?

There is one option where on the load of the Nintex Form call a JavaScript to append ?Source=<<Search page URL>> to the current window URL. This might cause the page to reload, but works.

Example:

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

window.location.href = window.location.href.split('?')[0]+"?Source=<<search page URL>>"

});

In case you have a button to close the form you can have the same line written on button click event.

The Source query string in the URL indicated where to go when user moves out of the current page.

OR

On after load of the form write the below JavaScript, which will update the From url after page load to include the Source query string :

NWF.FormFiller.Events.RegisterAfterReady(function (){
var oldAction=document.getElementById('aspnetForm').action;
var sourceIndx=oldAction.toLocaleLowerCase().indexOf("source");
var nakedAction=oldAction;
if(sourceIndx>0 )
{
nakedAction=oldAction.substring(0,sourceIndx-1);
}
document.getElementById('aspnetForm').action=nakedAction+"&Source="+ "<<To be redirected page URL>>";

}

Reply