It's all about the answers!

Ask a question

Customization attribute "calculated value"(Scripted base on) for HTML tags


HIROAKI JOSAKO (47427) | asked Mar 15 '16, 1:01 a.m.
edited Mar 15 '16, 3:02 a.m.
It has set a process for automatic input in the calculated value to the attributes of the HTML type.
HTML Tag from being displayed as it is as a string.
I think there is no way to express in a state of being HTML encoded?

example
[WorkItem View before]

BOLD TITLE

--------------------------------------------
in Script
 GetValue = workitemattribute(attributeId);
        //⇒"
<strong>bold title</strong> "
return GetValue;

--------------------------------------------

[WorkItem View after]


<strong>bold title</strong>   
I think there is no way to avoid?
Please,thanks 

Accepted answer


permanent link
Ralph Schoon (63.1k33646) | answered Mar 15 '16, 3:31 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I have not found a way to pass the text data from JavaScript into an HTML attribute without the tag information being escaped out.

From an API perspective, the data in such an attribute is an XML String. You can construct it from plain text, which escapes all tag data or you can create it as XML which leaves the tag data. I haven't found a way to do the latter in JavaScript. I can only do this in Java API.
Ralph Schoon selected this answer as the correct answer

Comments
HIROAKI JOSAKO commented Mar 15 '16, 10:30 p.m.

Thanks Ralph
Why
do you use XML?
Does this mean I do not use the "customization attribute"?
Instead, to create an Add-on in the JAVA-API?


Ralph Schoon commented Mar 16 '16, 4:12 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I know the Java API and that uses

XMLString.createFromXMLText() to create content for html attributes with html tags in it. I haven't found a way to pass the information in Java Script that conforms to this method.

XMLString.createFromPlainText() to create content for html attributes which results in any html/xml tags being escaped out - like you see in the JavaScript if you just pass a string with tags.

One other answer



permanent link
HIROAKI JOSAKO (47427) | answered Mar 15 '16, 10:34 p.m.
The results of the examination of this issue.
The last of the "return value" of the Script, we know is that it enables to some extent by changing.
Use the "decoration string" function of Javascript to value.

For example:
value.bold ();
value.italic ();

Disassemble the Attribute value for each HTMLTags.
"Value (i) <array>" and then consolidated with a Javascript function along to the tag.
For example:
    return value (0) + value (1) .bold () + value (2) .italic ();
view
    str0str1str2

Problem
1. It is an HTML document that has been freely written.
Because there is a need to pack to decompose and sequence for each tag from the beginning, you need to write a recursive processing.

2. failure to create a variable linked to before the return.
For example:
    temp = value (0) + value (1) .bold () + value (2) .italic ();
    return temp;
View
       str0
&lt;b&gt; str1 &lt;/b&gt; &lt;i&gt; str2 &lt;/i&gt;

In particular, "2." We believe that or not is impossible to solve.

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.