It's all about the answers!

Ask a question

Inputs HTML Special Characters setting an html type field using java script

nannette Mori (50142) | asked Oct 10 '18, 2:40 p.m.

In the extension java code there is a function to set the html text and another to set the plain text.  The way we are setting the text for an html type field using a java script we are getting the special character replacement in the output of the java script so it is almost as if it is doing the replacement of special characters for the html text but it outputs it as plain text so if for example there is an "&" in the html text our java script is replacing that with &nbsp and it makes our text fields difficult to read.  Is there a way to prevent this token replacement in the java script?

2 answers

permanent link
Ralph Schoon (61.4k33643) | answered Oct 17 '18, 3:19 a.m.

Do you meant to say that you have a JavaScript attribute customization and you try to set HTML attributes with HTML code and the html tags are escaped?

If so, this is to be expected. For all I know there is no way to set HTML there. The JavaScript API always converts to plain text for all I can tell.

permanent link
Jason Spegal (213) | answered Oct 17 '18, 5:29 p.m.

So we're seeing this as well. It looks like when the javascript is run the text stored in the workitem attribute text is being rendered html safe, and then that updated text is being saved.  As a result we're seeing things like & in the plain text, and & being rendered as the html text on the web page. Each time the java script runs it adds another amp; because it converts the & from &

Your answer

Register or to post your answer.