Displaying a hyperlink with text instead of the URL, via calculated value
Hi, I would like to generate the content of an HTML custom attibute, using Attribute Customization > Calculated Value. I want the field to contain a hyperlink, which would display a clickable text instead of the URL (e.g. display "Google" instead of www.google.com).
I know it is possible for users to generate this link manually via the "Insert External Link" in the WebUI toolbar. How can I do that with calculated value?
Note that I only use the WebUI, v3.0.1.2.
Thanks!
Accepted answer
This has been discussed in several other questions. Here the answer as it is:
-
When using JavaScript attribute customization https://jazz.net/wiki/bin/view/Main/AttributeCustomization I am not aware of a way to create the HTML syntax and get it working in the attribute. When passing a string with the right content, the string content is converted into an XML string and all the tags in it are basically escaped. (internally using XMLString.createFromPlainText()
- With a Java Based attribute customization you should be able to use XMLString.createFromXMLText() and avoid the escaping
- In other Java based extensions you can set attributes accordingly using XMLString.createFromXMLText()
Comments
Using the Wiki Syntax, you can use a Wiki type attribute and create a valid HTML link there. http://wikicreole.org/ explains the supported syntax.
6 other answers
I have tried to set a custom HTML attribute with the default value:
«a href="http://google.com"»Click here«/a»(with < instead of « and > instead of »)
The presentation is also HTML. But the text displays as above (including visible HTML tags), with the URL part automatically converted to a link. So this does not work for me...