2940
Views
13
Comments
Render HTML code from database as HTML
Question
Hi,

I'm currently working on a module wherein I have 2 fields: Title and Article. It is a CMS type of application. I would want the article to accept HTML codes (example: <b> text here </b>). That's okay but I want to also show this in HTML. So if I retrieve the article from the database, I want to display those enclose in bold tags as bold, etc.

Is it possible? 

Thanks
2022-11-12 11-28-30
Gonçalo Martins
Staff
Hi Geraldine,

You can do that using an expression with the property "Escape Content" set to the value "No".
This way you're allowed to inject HTML to you're screen, in your case, from the DataBase.

Regards,
Gonçalo M.
2020-08-24 05-59-49
Gemi Ablaza
Champion
Thank you, Gonçalo Martins!
2012-03-16 12-21-09
João Rosado
Staff
Hi,

Also when using un-escaped expressions you really need to be carefull, because it can allow unintended usages.
Many tags, For example <script> tags or even links can be dangerous if you allow anything to be included.
Read this: https://en.wikipedia.org/wiki/Cross-site_scripting

Regards,
João Rosado
2019-04-02 11-48-16
Martin Rozeboom

The "Escape content" function isn't available in Outsystems 10 on the Mobile side. So, all the HTML in my backend isn't shown properly in the frontend. 


How can I change this? 


João Rosado wrote:

Hi,

Also when using un-escaped expressions you really need to be carefull, because it can allow unintended usages.
Many tags, For example <script> tags or even links can be dangerous if you allow anything to be included.
Read this: https://en.wikipedia.org/wiki/Cross-site_scripting

Regards,
João Rosado



UserImage.jpg
Kevin Lu

I'm having the same issue as Martin: I'm pulling raw HTML content from Sharepoint that I'm having difficulty displaying on the Mobile side.

2021-05-05 13-05-18
Mykola (Nick) Tkachenko
UserImage.jpg
Kevin Lu

Mykola Tkachenko wrote:

Hi

Here is some solution that can work

https://www.outsystems.com/forums/discussion/20510/unescaped-content-on-mobile-app-v10/

This worked nicely, thanks!


2021-05-05 13-05-18
Mykola (Nick) Tkachenko

Hi Kevin, 

Did you use it on mobile app with phone theme?

It did not work for me with this theme but worked with another.

UserImage.jpg
Kevin Lu

I am using the phone theme, and some of the styles also seem to not be applying. I was just happy that I wasn't seeing HTML tags anymore.

Coincidentally, one of the tags that isn't displaying properly is also the <strong> tag. It looks like it's being overridden by the Base Theme, specifically the "font: inherit" property.


2019-10-07 14-56-14
Michael Furnari

Hello Goncalo Martins. I don't see the "Escape Content" property in the Expression object in OutSystems 11. I am building a reactive app.  

Is there another way to render html from a database field (<ol><li>first item</li><li>second item</li></ol>) as html in a table cell? The source of this table is an aggregate. 

Thanks 

2020-01-08 12-23-57
Jitender Gaur

Michael Furnari wrote:

Hello Goncalo Martins. I don't see the "Escape Content" property in the Expression object in OutSystems 11. I am building a reactive app.  

Is there another way to render html from a database field (<ol><li>first item</li><li>second item</li></ol>) as html in a table cell? The source of this table is an aggregate. 

Thanks 

Hi Michael, 


In Reactive app you can use CKEditorReactive forge to Insert and show HTML page from Database. You just need to drag and Drop editor widget and bind with your database filed. that's it.   


2019-10-07 14-56-14
Michael Furnari

Jitender Gaur wrote:

Michael Furnari wrote:

Hello Goncalo Martins. I don't see the "Escape Content" property in the Expression object in OutSystems 11. I am building a reactive app.  

Is there another way to render html from a database field (<ol><li>first item</li><li>second item</li></ol>) as html in a table cell? The source of this table is an aggregate. 

Thanks 

Hi Michael, 


In Reactive app you can use CKEditorReactive forge to Insert and show HTML page from Database. You just need to drag and Drop editor widget and bind with your database filed. that's it.   


Hi Jitender,

Yes, I am using CKEditor Reactive in the form which saves the data as HTML in the database. I understand I can use the SetContainerHTML client action to load one CK HTMLViewerContainer object on a form, but I'm unsure how to use the CK HTMLViewerContainer object in a table cell, and use the SetContainerHTML client action to render the HTML data from the database as the table loads. Maybe I'm overthinking this... coming from the .NET world. 

Thanks,

Michael   


2019-09-24 18-41-25
Jorge Martins
 
MVP

Hi Michael,

In Mobile and Reactive apps, OutSystems introduced an HTML widget that allows developers to generate HTML tags (allowing dynamic generation of HTML).

For your use-case however, this widget is not useful, as you already have the HTML in textual form. You should probably follow the solution suggested by Mykola above.

Hope this helps.

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