How to Capture Url of Referring Page in InfoPath Field - InfoPath Dev
in

InfoPath Dev

How to Capture Url of Referring Page in InfoPath Field

Last post 12-24-2012 07:48 AM by Jimmy. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 12-21-2012 10:42 AM

    How to Capture Url of Referring Page in InfoPath Field

    Hi. I created a simple "contact administrator" InfoPath form with an email workflow when form is submitted.  I need to capture the url of the referring page in a form field (preferably hidden) to include in the email sent by the workflow.  The intent is to be able to know which page the user was on when a problem occurred.

     

     

  • 12-23-2012 07:28 AM In reply to

    Re: How to Capture Url of Referring Page in InfoPath Field

    Two questions:

    • In your setup, is the InfoPath form embedded within the page, or is it the whole page (i.e. you're just showing a FormServer.aspx page)?
    • Do you have a way to pass the URL of the referring page as a query parameter in the URL of your InfoPath form page?  (e.g. &referringpage=http...)

    If the answers to the above are "whole page" and yes, then ther should be a way to accomplish this using either managed code or qRules.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-23-2012 07:37 AM In reply to

    Re: How to Capture Url of Referring Page in InfoPath Field

    Thanks for replying.

    1) The form is embedded

    2) Not sure I understand this (am a real newbie) but I'd say no.

    I think it is possible using this approach:http://blogs.msdn.com/b/joshuag/archive/2008/06/03/getting-the-current-user-name-or-id-in-sharepoint-using-sharepoint-designer-no-code.aspx, changing the server variable where applicable.

     will report back if successful.

  • 12-23-2012 09:31 AM In reply to

    Re: How to Capture Url of Referring Page in InfoPath Field [Solved]

     @Jimmy.  Thanks again for your reply.  Your use of the phrase "query parameter" eventually led me to the answer.  Basically, I created a custom list with a PreviousPage text field, loaded the list in SharePoint Designer and created a custom default "New Form".

    I then added a new server variable parameter: <ParameterBinding Name="ReferringUrl" Location="ServerVariable(HTTP_REFERER)" DefaultValue=""/> to the custom form.

    From there, I  edited changed the SharePoint form field to an ASP text control to pass the server variable results to:   <asp:TextBox runat="server" id="ff5{$Pos}" text="{$ReferringUrl}" __designer:bind="{ddwrt:DataBind('i',concat('ff5',$Pos),'Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ReferringPage')}"/>

    I checked it a few  times and later changed the text field holding the referring url to hidden.

  • 12-24-2012 07:48 AM In reply to

    Re: How to Capture Url of Referring Page in InfoPath Field [Solved]

    Excellent.  Thank you for sharing your solution with the rest of us.
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.