It's all about the answers!

Ask a question

Displaying a hyperlink with text instead of the URL, via calculated value


Thibault Leclercq (9011013) | asked Nov 16 '12, 4:53 a.m.
 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


permanent link
Ralph Schoon (63.4k33646) | answered Sep 14 '16, 7:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Dec 08 '17, 8:55 a.m.

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()

Ralph Schoon selected this answer as the correct answer

Comments
Ralph Schoon commented Dec 08 '17, 8:55 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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



permanent link
Manjunath Badiger (3229) | answered Dec 08 '17, 5:25 a.m.

 If we add a custom attribute of type Large HTML where we can assign the Some text the url value and add it in the editor presentation were we wnat to call. Then this is possible.







Comments
Ralph Schoon commented Dec 08 '17, 7:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I suggest you really read the accepted answer.


permanent link
Donna Thomas (14122649) | answered Sep 01 '16, 12:52 p.m.
Any updates?

permanent link
Thibault Leclercq (9011013) | answered Nov 16 '12, 7:53 a.m.
edited Nov 16 '12, 7:55 a.m.
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...

Comments
Ralph Schoon commented Nov 16 '12, 8:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I tried using Attribute customization and using a script. I see the same you see.


Martin Muellenberg commented Dec 10 '13, 8:42 a.m.

I also can not get the link text to be displayed instead of the actual link location, neither with Wiki nor with an HTML attribute. Any news with regard to this?


permanent link
Ralph Schoon (63.4k33646) | answered Nov 16 '12, 7:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Nov 16 '12, 7:21 a.m.
I used a script to peek and the text it uses for a hyperlink is unsurprisingly HTM syntax:

[a href="someURL"]Some Text[/a]

(Replace [ by <)

This works for HTML attributes. Wiki Type attributes use the documented Wiki Syntax.
In Links on the inks tab the comment is used.


permanent link
Thibault Leclercq (9011013) | answered Nov 16 '12, 5:37 a.m.
 If I export the content of the attribute in plain text it only shows the text, not the link...

Comments
Ralph Schoon commented Nov 16 '12, 5:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Have you tried to use the API to get the content?


Thibault Leclercq commented Nov 16 '12, 5:58 a.m.

I don't use / know how to use the API... 


permanent link
Ralph Schoon (63.4k33646) | answered Nov 16 '12, 5:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,

I would suggest to get the content of such an example attribute and look at the syntax in the plain text.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.