none
Append Querystring Value on Hyperlink in InfoPath RRS feed

  • Question

  • I have a custom InfoPath edit form for a SharePoint 2010 list.  What I would like to do is include a hyperlink within the form that points to some other page, appending a querystring variable value that pulls the value from one of the fields of the SharePoint list.  So if the user edits item 1, the url would point to "http://site/page.aspx?value=1", and if they edit item 2 the url would point to "http://site/page.aspx?value=2".

    I can't seem to do that with the Hyperlink control in InfoPath.  I was thinking of maybe using a calculated column in the SharePoint list that contains the URL with the querystring value already appended and then use that as the source for the hyperlink.  Haven't tried that yet.  Any other ideas?  I'm not an InfoPath guy so hopefully I'm missing something easy.


    http://randomdust.com/blogs/ryan
    Monday, September 20, 2010 6:48 PM

Answers

  • I don't really understand what you mean.  You didn't mention TargetSite before.  You said it was, "SharePointSiteCollectionUrl() + "/Lists/TestLlist/newifs.aspx?ID=" + ID" and I'm assuming that's all within a concat() function with commas instead of plus signs.  Can you explain the TargetSite thing in more detail and how it would reside within "Lists"?
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, September 21, 2010 6:01 AM
  • TargetSite was just some text as an example so I didn't type out the entire URL.

    That concat function is what I was looking for!  The way I had it with the plus signs was indeed how I had the string entered in the form.  That's my programming background for you.  I knew it was something simple...thanks Clay.  Next time you have a programming question, I owe you.


    http://randomdust.com/blogs/ryan
    Tuesday, September 21, 2010 7:02 PM

All replies

  • Seems like it would be easy to use a default value formula on the Hyperlink field that has a concatenate command, or use a rule that sets the hyperlink field to the concatenate formula you need.  Unless I'm missing something, it seems quite easy, so let me know more details or let me know what you tried that didn't work.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, September 21, 2010 1:46 AM
  • To do that I need a field in my data source, right? Can I add a field to a data source within the form that isn't mapped to a column in SharePoint? Or do I have to have a column in my SharePoint list to use for that?

    http://randomdust.com/blogs/ryan
    Tuesday, September 21, 2010 3:39 AM
  • On a list form, yes, each field is a column.  However, isn't your hyperlink field already a column/field?  You don't need another one except whatever field you're using as the variable for the query string.  Aren't you using ID?
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, September 21, 2010 3:47 AM
  • Yeah, I'm using ID.  I have a form load rule to set a field value to SharePointSiteCollectionUrl() + "/Lists/TestLlist/newifs.aspx?ID=" + ID. And I have the hyperlink data source set to that field. But when I open the form from the list it doesn't have the correct URL.  Any thought on what I'm missing?
    http://randomdust.com/blogs/ryan
    Tuesday, September 21, 2010 4:22 AM
  • What does it show when you do that?  That command is only going to get the URL to the top level site of the current site collection, such as http://mysite.mycompany.local or http://mysite.mycompany.local/sites/site, but it won't get you to http://mysite.mycompany.local/sites/site/subsite and then append the rest to it.  Don't you need to get the full site path, or are you working directly on the site collection's top level site?  Regardless, I'd need to know WHAT result you're getting in order to help you troubleshoot it.  Otherwise, I have no way of knowing why it's not working unless my guess above was lucky.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, September 21, 2010 4:43 AM
  • I'm at the top level site on the site collection.  Using SharePointSiteCollectionUrl() works fine (links to http://site), but as soon as I add "+ '/TargerSite'", the URL when rendered becomes a URL to the list that contains the form. In my case, http://site/Lists/CurrentList/Custom%20Type/. When I'm expecting "http://site/Lists/TargetSite".

    http://randomdust.com/blogs/ryan
    Tuesday, September 21, 2010 5:43 AM
  • I don't really understand what you mean.  You didn't mention TargetSite before.  You said it was, "SharePointSiteCollectionUrl() + "/Lists/TestLlist/newifs.aspx?ID=" + ID" and I'm assuming that's all within a concat() function with commas instead of plus signs.  Can you explain the TargetSite thing in more detail and how it would reside within "Lists"?
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Tuesday, September 21, 2010 6:01 AM
  • TargetSite was just some text as an example so I didn't type out the entire URL.

    That concat function is what I was looking for!  The way I had it with the plus signs was indeed how I had the string entered in the form.  That's my programming background for you.  I knew it was something simple...thanks Clay.  Next time you have a programming question, I owe you.


    http://randomdust.com/blogs/ryan
    Tuesday, September 21, 2010 7:02 PM