Forum Discussion
My guess: You forgot some " or html tags somewhere. Your static text is executed as script.
Do you use something like this?
htmlContent += "<td>This is my text inside a table. For this example we add a lot of words like this.</td>";
- henry_yc8 months agoIdeator I
I do something very similar.
var technical_review_checklist =
"<html>" +
"<tbody><tr>" +
"<td width=\"80%\"><span style=\"font-weight: bold;\"Checklist Item</span></td>" +
"<td width=\"80%\"><span style=\"font-weight: bold;\"Y/N/NA</span></td>" +
"</tr>" +
"<tr>" +
"<td> 7. The level of detail in the document is suitable for this phase of development.</td>" +
"<td></td>" +
"</tr>" +
"</tbody></table>" +
"</html>"Sorry about the text, it doesn't show properly when I use a code block.
Anyway, it works properly when I use it to pre-fill the field as a Form Event, but gets weird when I use it to replace the text as a Field Event.
- AngelaIp7 months agoIdeator I
The first "table" tag is missing, but I guess you reduced the code sample for this post.
srcElement is typical for field events and as far as I know contains the field context itself. It´s like "this" for fields.
What exactly do you replace? Do you re-render the complete html table with the same code?
I assume you use a html element for your custom table. What code do you use to write the table content itself?
Something like document.getElementById("mytable").innerHTML/innerText = tableStuff ?And check in the browser debugger how the table looks like in native html. Maybe you find some hints for any missing tags or similiar.
- henry_yc7 months agoIdeator I
Yes I re-render the entire html table with the same code.
The table is inside a formatted text box with the field name "_technical_review_checklist". To write the table content (I think this is what you're asking), I use document.thisItem.setProperty("_technical_review_checklist", technical_review_checklist).
After mucking around, I found a workaround. If I put an escape character inside the word like "t\his" then the word renders properly. Acceptable solution but I am still interested to know why this is happening.