Forum Discussion

grant_jenkins's avatar
grant_jenkins
Steel Contributor
Aug 10, 2024
Solved

List Form Formatting - can't get title and hyperlink from Hyperlink column

I have a Hyperlink column and trying to display it within the footer of the List Form using JSON formatting. However, I can't seem to split the Title and URL of the Hyperlink value.

 

If I just try to get the value using "[$FieldName]" it returns the URL and Title, comma separated.

 

Is there anything special I need to do here, or is it a bug with the new MS Lists in SharePoint Lists that's causing the issue?

 

Note: I found that someone else faced the same issue - looks like a bug with the List Form formatting.

 

JSON formatting on form Header - Getting just the link of a Hyperlink field : r/sharepoint (reddit.com)

  • Hi grant_jenkins, You are right; the Hyperlink column value behaves differently in column formatting compared to form formatting.

    Fortunately, you can use the following function to retrieve Hyperlink column information in form (header or footer) formatting:

    - Url

    "txtContent": "=substring('[$FieldName]',0,indexOf('[$FieldName]', ','))"

     and title

    "txtContent": "=substring('[$FieldName]',indexOf('[$LinkTest]', ',')+2,indexOf([$FieldName] + '^', '^'))"
  • michalkornet's avatar
    michalkornet
    Iron Contributor

    Hi grant_jenkins, You are right; the Hyperlink column value behaves differently in column formatting compared to form formatting.

    Fortunately, you can use the following function to retrieve Hyperlink column information in form (header or footer) formatting:

    - Url

    "txtContent": "=substring('[$FieldName]',0,indexOf('[$FieldName]', ','))"

     and title

    "txtContent": "=substring('[$FieldName]',indexOf('[$LinkTest]', ',')+2,indexOf([$FieldName] + '^', '^'))"
    • LauraDaisy's avatar
      LauraDaisy
      Copper Contributor

      michalkornet hello I have a similar issue - i have different URLs and Alternative text in a Hyperlink Column. In the normal list they work fine, but when I apply JSON in Format Current View the link doesnt work. It opens to about:blank.

       

      What is missing from my code?

       

      Thank you,

      • michalkornet's avatar
        michalkornet
        Iron Contributor

        Hi LauraDaisy, could you provide the part of your View formatting code related to the URL column? I’ll try to check it promptly.

    • grant_jenkins's avatar
      grant_jenkins
      Steel Contributor
      Hi Michal,

      Thanks for your confirmation. I've already set them up using the configuration you mentioned above. Hoping Microsoft will fix some of these issues so things work as expected across lists, forms, etc.

Resources