Unescaped content on mobile app v10

Unescaped content on mobile app v10

  

Hi,

 I have a html content (with strong and italic formatting) in database that I want to display. 

In Expression of mobile app in version 10 there is no "Escape content" property - is it possible to show unescaped contend in mobile app?


Thanks

Solution

Hi Mykola,

It is possible using the Javascript node.

Create a container on your screen where you want to put the content and give it a name.

Then in the ready event hander of the screen (check the screen properties):
1) get the content that you want to display
2) create a JS Node
3) pass the content and the container id to the JS Node
4) write something like this is the JSNode
    document.getElementById($parameters.ContainerId).innerHTML = $parameters.Content
5) win!

Solution

Hi João,

Thanks - that will work. 

Hi João,

However when I've tried this it actually puts proper html inside container, but styles are not applied - I have <strong> tag inside for example but text is still normal (nothing is overriding it). 

Any suggestions?

Thank you

When inspecting the strong text (using dev tools) where does the font weight come from? The browser default is bold, so something might be overriding it.

Hey Mykola,

This was already answered in this post. In there you have a module that will cover the scenarios you describe.

Cheers,

Sérgio


Hi


João, it is browser default and it is not ovverided by anything, I have more specific classes inside that dynamically added block too and they are not applied either. If I create a container with this class - it is displayed properly.


Sérgio, I can't see the post by your link - have "You don´t have permissions to read this forum." error.

Have you got a <p> wrapping the content? That might be the problem. If you use <b> instead of strong you don't need a wrapping <p>

Hi Mykola,

You're right, wrong link. I'm attaching the OML to this post. Essentially, it's a module where you load HTML content from the database and render it using João's answer. All styles should be applied, unless you have some CSS rules or HTML that stop that from happening.

Cheers,

Sérgio

Hi Sérgio,

Thank you very much for oml - it worked perfectly.

However there is definitely something in my app that conflicts with this.. I've copied screen and entity to my app and it gives me same result as before - html is inserted but styles are flat... I will investigate deeper the problem (I think it might be related to jQuery library that is included in my app or P10SILK Base Theme... ) and will post here what was the problem. Or if you have any suggestions it might help also.

Thank you again

Hi Mykola,

Do you have a sample you can share that does not work as expected?

Sérgio 

Hi Sérgio,

I've attached OML that was created as a new mobile app with phone only theme and I busted copied screen and entity from your app. 

The code I'm testing and that is working on your OML is this:

<strong>Bold text...</strong>
<br>
<ul>
<li>List item</li>
<li>Another list item</li>
</ul>
just text