Render HTML code from database as HTML

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
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.
Thank you, Gonçalo Martins!
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

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



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.

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!


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.

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.


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 

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 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.

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