Search the FirstSpirit Knowledge Base
Hi,
Good Morning. My current FirstSpirit Server version is 5.2.212.71463.
I have a table "labels" with a column name "content" which is a FirstSpirit-Editor column type. This column is mapped to a CMS_INPUT_DOM element (name:tt_content) in a table template. In the labels data source, I have added the content <i class="test">dkfjd</i> into the DOM element. When i loop through the labels entity and print the output of the content column , I get the xml escaped String.
Is there any settting/API method to get the actual content added into the DOM without escaping the String.?
Expected O/P : <i class="test">dkfjd</i>
Actual O/P - by using various API methods in de.espirit.firstspirit.access.editor.value.DomElementImpl
for_each_label.content.renderToString : <i class="test">dkfjd</i>
for_each_label.renderToString.convert : &lt;i class=&#34;test&#34;&gt;dkfjd&lt;/i&gt;
for_each_label.content.print : <i class="test">dkfjd</i>
for_each_label.content.toText(true) : <i class="test">dkfjd</i>
for_each_label.content.normalize : <i class="test">dkfjd</i>
In FS 4.2.461.48921 , renderToString method was printing the actual content of DOM Element where as in Fs 5.2 it is escaping the content.
Upendra
Hi Upendra,
what happens if you just use $CMS_VALUE(for_each_label.content)$ to output the content column?
If the content is correct HTML you don't neet to escape it. The method renderToString() should be used only in special cases.
Best regards
Marian
Hi Marian,
Using the content also escapes the content as below.
for_each_label.content: <i class="test">dkfjd</i>
Upendra
Hi Upendra,
Maybe a textfield or the standard formatting within the DOM is a better solution. Can you give us your use case?
Best regards
Jan
Hi Jan
Text field would not suffice as we need to add some internal links using a link template. So DOM is needed. Standard formatting in DOM would not suffice as we have around 60 small labels/html snippets (15 per Site * 4 Sites). We will not be able to create a separate data source / separate DOM element for each of them.
Use Case: On our site, we haveTool Tips, Learn more Popups etc which have various small html snippets with different css class names per html tag . So standard formatting with DOM would not suffice.
Example of sample snippets :
Tool tip1 could be : <div class="class1">Tooltip1</div>
Tool tip2 could be : <SPAN class="class-tip2 "><div class="test1">Tooltip1</div></SPAN>
Learnmore1 Popup could be : <DIV class="popup1"> Learn More Text 1 <a class="learnmorepopover1-close" aria-label="Close">X</a> </DIV>
Learnmore2 Popups could be: <P class="learnmorepopup2"><a class="learnmorepopover2-close" aria-label="Close">X</a> </P>
Do you know why for_each_label.content.renderToString in FS 4.2.461.48921 was not escaping the content, where as it does escape in FS 5.2.212.71463 ?
Upendra
Hi Upendra,
if you enter HTML inside an DOM editor component it will be escaped. This is intended. It may be that the old 4.2 behaviour caused some problems so it was fixed in 5.2.
Inside a DOM editor commponent you can work with format templates to have customs tags like <p class="note">. So if you enable them inside the GOM you can select a text inside a dom editor compoment and assign such a "style". Isn't this what you need?
See http://www.e-spirit.com/odfs52/template-development/forms/input-components/dom/#s1 for more information (switch to English in the top if the German version is displayed)
Regards
Marian
Hello Upendra,
is this still an open question? Do you need further help or did the given replies already help you? If so it would be great if you mark the "correct answer".
Best regards
Michaela
Marian,
This isn't what I was looking for. In our test case we have around 30 different html snippets. So, creating 30 format templates and adding them in DOM would not work. Since the html snippet was small, we were ok to add the html content directly to the DOM and we needed a way to directly read the HTML added in the DOM with out escaping it. This way instead of creating 30 format templates , we could live with adding small html snippets into the DOM.
Upendra