By default, a hyperlink type field in a SharePoint Online list looks like a regular field. It's not until you hover over the text that you actually see that it's a hyperlink.
I am trying to edit/format this field so it "pops" (i.e. underline and blue-color the font; shade the background, etc.).
I am able to achieve this by using a simple JSON script; however, it only works when the hyperlink is pointing to a web-based source (i.e. google.com
). Some of my items have a hyperlink that direct the user to a file directory instead (i.e. //server_name/files/samplefile.docx
). For these type of hyperlinks, the JSON script simply blanks the field.
Any help?
Here is the list:
Here are the values for item 1:
And the values for item 2:
And there is the JSON script being applied to the "Test" field:
{
"$schema": "http://columnformatting.sharepointpnp.com/columnFormattingSchema.json",
"elmType": "a",
"txtContent": "@currentField.desc",
"style": {
"color": "red",
"font-weight": "bold"
},
"attributes": {
"target": "_blank",
"href": "@currentField"
}
}
https:// tenant.sharepoint.com/sites/SPName/Shared%20Documents/Document.docx