InfoPath form - redirect to new page on submit

Brass Contributor

I thought this should be simple, but I'm having trouble finding a solution. I have a survey form that was customized in InfoPath 2013. The home page of my SharePoint site has a form web part that displays a blank customized form at all times. I created another page that I wanted users to see when they submit the form... I was hoping I could just embed a redirect script on the confirmation page that would bring up the survey page again a couple seconds after the confirmation page appears. I couldn't figure out a way to do that in InfoPath, so I enlisted the help of our SharePoint support team. Their solution was to create a new view of the form in InfoPath... so basically everything happens on the site home page. When users fill out the survey and submit, the "submit" form appears. There is a redirect script embedded on my home page, and every 10 seconds the page "refreshes." The problem with that is that a user could be in the middle of filling out the survey (3 quick questions) when the page redirects, and they have to start over.

 

I hope I've described the situation... if anyone knows of a solutions, please share. Nothing too complicated please :)

6 Replies

Hi Allison,

 

Just want to clarify first....

You have one form with 3 questions.....on clicking submit....you want a secondary form to appear on screen (you mentioned a submit form)?

 

If this is correct - is there any issue with saving the details from both survey and submit forms in the same list?

If not, why not just create another view in infopath called 'submit', add in your form fields for this form as required....
On your survey form, on the submit button (on click) change the view to the submit view?

 

If I have misunderstood, apologies.

What you've described is what we've already done. My apologies, I probably didn't explain very well. The home page of the SharePoint site is just a form web part showing the InfoPath form (edit view). When users clicks on the submit button, the submit view appears in the web part. The problem is getting it to automatically go back to the edit view after a few seconds. The developer placed a redirect script on the homepage... but what that does is refreshes the page every 10 seconds or so, and a user could be in the middle of filling out the survey when the screen refreshes. Plus it's annoying to see the screen blink every 10 seconds!

No worries Allison.

 

So, in actual fact the submit view does nothing? Just has some information on it?

Rather than have auto refresh on the page, could you not add a link or button the user would need to click on which then refreshes the page?

That's correct, the submit view does nothing, it's basically a thank you/confirmation message. Client doesn't want the user to have to click on anything to go back to the form, he wants it to be automatic.

Ok, so rather than an auto refresh then, you need an event, followed by a delay and then the action of refreshing the page.

 

Can your SharePoint support team not create an onclick event using Javascript?

I ran into the same thing when trying to leverage the source parameter in the infopath form url. I found this article https://sharepoint.stackexchange.com/questions/41291/redirect-a-user-after-submitting-an-infopath-fo... that recommends this script... 

<script type="text/javascript">
function RedirectIfFormIsClosed(){
    var elem = document.getElementById('DialogFinalMessage');
    if (elem !== null && elem.children.length > 0) {        window.location.href = GetSource2();
    }
}
ExecuteOrDelayUntilScriptLoaded(RedirectIfFormIsClosed, "inplview.js")
</script>

 So basically then you can define the Thank You URL using source= and if you don't want to use source you simply replace the variable 

GetSource2()

with your Thank You URL.

 

Note: I ended up using a second view and didn't try the above. Maybe I will try it out now :)