Wednesday, January 17, 2007

InfoPath Forms Services close button redirection

In my installation of MOSS 2007, editing a browser-enabled InfoPath form in a document library by choosing Edit in Browser from the context menu doesn't pass the 'Source' parameter (described in a post by Scott Jamison here) in the URL to the /_layouts/formserver.aspx page. The parameter is passed correctly when creating a new form in the document library. The result of this is two different behaviors when users are finished editing the form and click the close button. If it's a new form, there is a postback and the browser redirects to the document library. If it's an existing form that is being edited, the browser doesn't redirect, instead it shows the following dialog:

The form has been closed.


I came up with a work around - editing the custom action in the IPFS file:

%PROGRAMFILES%\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\IPFSSiteFeatures\FormServerEcbEntry\EcbEntry.xml


...and changing the appropriate UrlAction elements to include a source parameter, i.e.


<UrlAction Url="~site/_layouts/formserver.aspx?XmlLocation={ItemUrl}&amp;OpenIn=Browser&amp;Source=&lt;SCRIPT&gt;document.write(escapeProperly(window.location.href))&lt;/SCRIPT&gt;"/>

It's not the best solution however (because the file will get overwritten by any updates etc.) - but I haven't seen any other answers out there.

5 comments:

  1. I tried this workaround and it doesn't work :(

    ReplyDelete
  2. Great Article! Thank You!

    ReplyDelete
  3. Thanks to author! I like articles like this, very interesting.

    ReplyDelete
  4. This worked well for me, thanks! Another option is to create a view that acts like a confirmation page and then add a switch view behavior to your submit options. Thanks again!

    ReplyDelete
  5. It worked fine.
    Just that we need to forcefully reactivate the feature.
    and iisreset

    ReplyDelete