Display Formatted HTML
Question

Hi,

I am using CKEditor to collect information in a text field.  I am now trying to display that text on a form without the mark-up showing up, but I would like to show the formatted text.  Below is a simple sample of what is returned.


<p><span style="color:#e74c3c">I want this to display as Red.</span></p><br/><br/><p><span style="color:#3498db">And this as blue.</span></p><br/>

I am sure it is something simple, but what do I need in order for that text to display as red and blue

Thank you in advance.

Trav

mvp_badge
MVP
Solution

Hi Travis,

You can use a expression with the property "escape content" set to "No".

But you need to be careful because users can include <script> tags and harmful code in ckeditor since you aren't escaping the text.

Regards,

Marcelo  

Hi, can we display the html content using RunJavaScript Server Action(Traditional) using window.open() ?

I'm having html content and script inside html tags

Below is the sample of my HTML

<html>

<script>

 window.onload = function() {  }  } </script>

 <script src=""</script>

 <script>var options ={""}}

 </script>

 </script>

 </html>



Thanks.


Hi Sandeep,
If the content is not from a User response(Security concern) ,it can be generated in an expression--with Escape Content set to No

Thank you for the quick response.

I tried that previously, but then added that EncodeHTML function to the expression as per the warning service studio gave me.  I didn't think to try it without the function.  Clearly I am not a real web developer.  :)

Thank you again!!!

mvp_badge
MVP

Hi Travis,

EncodeHtml() escapes all the HTML tags. That's why it wasn't working.

Regards,

Marcelo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.