-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a question about SAMPLE generic-hyperlink-values #584
Comments
Hi @oshihirii ! {
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
"href": "= 'https://<<tenantName>>.sharepoint.com/sites/<<siteName>>/<<documentLibraryName>>/Forms/<<View>>.aspx?FilterField1=Choice&FilterType1=Choice&FilterValue1=' + replaceAll(@currentField,'&','%26')",
"target": "_blank"
}
}
]
} |
The method without replaceAll did not filter properly for me as well. |
Hi @tecchan1107 , Thankyou, it is a good idea and your approach is what I am implementing now. For it to be a truly thorough solution, I am wondering if somebody smarter than me could figure out a That way we could be confident that any value we are grabbing from another column to create a filtered list URL (using JSON formatting) will be encoded as required. I guess it would basically imitate an encodeURI() function. The first step would be defining all the illegal characters in a SharePoint list URL. I have searched and the only illegal characters I come across are those relating to file names, eg:
But I am not sure if they are the same characters that are not allowed in a SharePoint list URL. Related Reading: Restrictions and limitations in OneDrive and SharePoint > Invalid characters |
Sample
https://github.com/pnp/List-Formatting/tree/master/column-samples/generic-hyperlink-values
Question
The code shown in the example above:
works well as long as the dynamic URL:
&
For example, I am trying to generate a dynamic URL based on the value in another column.
The dynamic URL is a link to a filtered view of a document library, eg:
If the value in the other column includes an ampersand
&
, the URL breaks when clicking on the dynamic URL.Is there anyway to URL encode the column value when adding it to the dynamic URL?
The text was updated successfully, but these errors were encountered: