It's all about the answers!

Ask a question

Rational Team Concert - Calculated Value - Insert link in a html field


Juan Martín Alberti (201417) | asked Mar 04 '14, 10:51 p.m.
edited Mar 05 '14, 5:08 a.m. by Ralph Schoon (63.1k33645)
Hi everybody.
I want to know if it's possible to insert a link in a HTML custom field from a script based calculated value.
This links it's constructed in the script dinamically with other values in the form.
We have installed RTC 4.0.3.
Thanks a lot.

2 answers



permanent link
Ralph Schoon (63.1k33645) | answered Mar 05 '14, 5:07 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Mar 05 '14, 8:29 a.m.
Yes, HTML attributes are supported when using JavaScript. It is basically filled with a string. See https://jazz.net/wiki/bin/view/Main/AttributeCustomization and https://jazz.net/library/article/1093 (Lab 4 and 5) for some hints.

Comments
Ralph Schoon commented Mar 05 '14, 5:09 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

To figure the format for HTML links I would export existing data with a link and look at how it is represented. I have not tried that with HTML myself, as far as I remember. The format for a wiki type attribute can be found in Lab 5 of the workshop above.


Juan Martín Alberti commented Mar 05 '14, 8:23 a.m. | edited Mar 05 '14, 8:26 a.m.

Thanks Ralph.

The thing with what we waht to do is that with the script we are returning something like this:
<a href="http://www.google.com">Google</a>
And when we save the Work Item the field value instead of showing Google is showing <a href="http://www.google.com">Google</a> with the complete html.


1
Ralph Schoon commented Mar 05 '14, 8:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

My suggestion would be to use the lab 5 JavaScript 'spy' tool to look at what is available in a HTML field with a link and use that syntax for you own script. I can only provide an example for Wiki attribute types and did so in the Lab 5.


permanent link
Ralph Schoon (63.1k33645) | answered Jan 05 '16, 7:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I have looked into that again recently and here is the catch.
When using the JavaScript API, the provider returns a string. When returning a string, all XML characters are escaped. So it is essentially not possible to create a link in any HTML attribute, including the description.

In the Java API, it is possible to use an XMLString to create the content from XML, which can contain the HTML tags for a link and set that, but it is not possible from JavaScript.

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.