Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I made a custom list in SharePoint and then created an InfoPath form based on that list. I created a new page in my SharePoint publishing site and added an InfoPath Form Web Part that looked at my list/form. Everything works great.

My questions is, how can I get the form to redirect to another page (thank you, confirmation page) when the user clicks submit on the page?

Seems like a simple task, but I have been unsuccessful.

share|improve this question

4 Answers 4

I am loading an infopath form inside the InfoPath Form Web Part after clicking a link from another page. I wanted to use the Source URL parameter but found it wasn't working.

Here is my solution:

<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>

If you don't want to use the Source URL parameter, modify the script above by removing the GetSource2() function and replacing that with the url string you want to redirect to.

share|improve this answer

You can simply create another view within the form and when they click on the button submit, the form will switch the views from the submission view to the "Thank you" view.

share|improve this answer
    
Are you able to insert html into a view for a custom look? I tried creating another view but could not figure out how to add html markup (including images). –  Rkstarcass Jul 31 '12 at 20:47
    
@Laaziz (aka M Najib Laaziz) This is very confusing - you are putting multiple answers under multiple user accounts explaining something without any links to previous edits. Anyway, what do you mean under "InfoPath uses ASPX anyways"? –  Gennady Vanin Геннадий Ванин Aug 3 '12 at 8:04

What I've done in the past was the following:

  • Utilized an InfoPath Web Part that displayed the form.
  • In the Submit Options in "InfoPath" you can select "Advanced" and set submission success and submission failure messages, and after submit "Close the Form".

At this point, your page will look clean and won't need to affiliate a separate page redirect, and won't need to "redirect" to a separate page. In hindsight, the alternative would be doing Gennady's suggestion.

share|improve this answer
    
This was the original route I took, but the client has a specific look and html markup they want displayed after the form is submitted. Thanks for the suggestion though. –  Rkstarcass Jul 31 '12 at 20:46

It seems to me you are confusing:

  • the Infopath web page form with a webpage. The Infopath form never exists independently on or all by itself (as webpage) but is used to be included (and linked) as webpart into a webpage or to generate a webpage.
  • the url following "&Source=" with the url of web page the user has come from. It is really a destination url the visitor will be redirected after hitting Submit or Close webpage button.

    "the link the user clicks on to get to my form" is unrelated to redirecting "to another page (thanks you, confirmation page)"?!
    Update: This was a comment to a changed now phrase from original question:

    • "I have seen many articles that talk about amending the infopath url and adding &source="", but since I am using a webpart, I do not have control over the link the user clicks on to get to my form, since it is embedded in my page"

Update (in reply to comments of Rkstarcass):

  • "Are you able to insert html into a view for a custom look? I tried creating another view but could not figure out how to add html markup (including images). – Rkstarcass"

    Infopath form (template) is XML data for a form and/or data associated with a form. These XML data can be rendered (or used) by external tools or services in HTML, as one of the possible formats generated from them dynamically.

    While it is not impossible to include HTML or Javascript as XML content, it is not what Infoapth Designer for by design.

  • "This was the original route I took, but the client has a specific look and html markup they want displayed after the form is submitted. Thanks for the suggestion though. – Rkstarcass"

    This is the main problem dealing with customers confusing Infopath Designer, being just a visual XML editor, with HTML/web application/pages editor or development tool. While it is not coompletely impossible but it reverses and perverts the whole idea of Infopath as codeless platform of designing XML data to be used externally. And automatically, according, to , for example, sharepoint built-in models, styles and templates.
    In other words, use:

    • use HTML (web application) dev tools for HTML (webpages, web app) development.
      Generally, HTML/web pages can use (embed, link, include) XML or even be generated from XML but Infopath Designer is not HTML/web page dev tool
    • use Sharepoint server, services and tools to leverage sharepoint styles, behavior and models
    • other development tools, frameworks and platforms for something different

Trying to use Infopath Designer for creating HTML is to crack the tool for its use against what it is for by design which is creating XML-based forms and/or XML data associated with XML-based forms.

share|improve this answer
    
-1, I understand you are trying to explain to @Rkstarcass but your answer makes no sense to me and doesn't seem to answer his questions at all. –  Kit Menke Nov 13 '13 at 3:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.