5440
Views
18
Comments
Solved
Expression Escape Content in Reactive Web
Question

Is there an alternative to 'Escape Content' on an expression in a Reactive Web application? If not, are there plans to add it? 

Yes, I know I can (and should) use widgets to build the UI, but in certain cases I may want/need to build an HTML expression.

2011-08-23 22-04-05
Tiago Simões
Staff
Solution

Just an update just to let everyone know that there is a Forge component for this that will allow you to stay away from having custom JavaScript directly in your apps (which is always a good practice):

Cheers,
Tiago Simões

UserImage.jpg
Shaun11

Thanks Tiago Simoes. It works for me as well :-)

2022-05-19 14-01-44
Varada Rajan

Very Useful straight forward Discussion, Thanks Tiago Simões  and Eduardo Jauch 

2022-07-08 12-35-50
Balaji Rajaram

Hai Tiago Simões

i follow your ideas all fine but i find some threads

i can choose first line is small type of text and another one line is huge type of text 

when i am save to db it will save normal type of text please refer the below images 

how to clear the issues kindly teach me.

 

2020-02-28 09-46-54
Eduardo Jauch

Hello Joseph, 

I didn't took a deep look into reactive, but as ut and mobile uses the same programming model, I would say you can use the HTML widget in the screen. 

It exists in mobile and should exists in Reactive Web apps as well... 

Cheers 

2011-08-23 22-04-05
Tiago Simões
Staff

Hi Joseph,

You will need to use a JavaScript node to set the innerHTML of some widget.

Cheers,

Tiago Simões

2020-02-28 09-46-54
Eduardo Jauch

Hello Tiago,

Can't use the HTML element?

2020-02-28 09-46-54
Eduardo Jauch

OK, I see.

With the HTML element, you will need to build every part of the HTML piece of code using the canvas (with potentially other HTML elements), while using JavaScript you can just "write" your HTML and inject it...

I would like to have the "unescaped" expression... Neither available way is good...

Cheers

2011-08-23 22-04-05
Tiago Simões
Staff

Hi Eduardo,

You can encapsulate the JavaScript above in a block (as shown in the screenshot) and use it as a widget. 

Cheers,

Tiago Simões 

PS: be sure to sanitize the HTML content, so users are not allowed to inject arbitrary JS in your app. 

2020-02-28 09-46-54
Eduardo Jauch

Tiago Simões wrote:

You can encapsulate the JavaScript above in a block (as shown in the screenshot) and use it as a widget. 

If you meant to use more than one time, this will enable you to create a reusable piece of code.
I was thinking more about a "one-time" injection. The old "non-escaped" expressions were more practical :)

But after a little thought, I understand that injecting HTML is not a good practice (for obvious reasons) and so, it should be used only rarely. So, yes, I accept your solution ;D

Thank you!

Cheers!


2011-08-23 22-04-05
Tiago Simões
Staff

2 more things:

- the HTML element is static so that Service Studio knows how to render it, and is useful to create UI components.

- it may go without saying, but it’s a good practice to centralize generalist blocks with custom JavaScript and HTML in libraries, so it’s easier to maintain. The less JS you have on your app, the easier it will be to change it in the future. 

2020-01-06 15-31-25
Joseph Robinson

Thanks guys. Yes, I was aware of the HTML widget, but as you indicated, I would have to chain them together so it won't work for my purpose. The javascript option worked perfectly, though (I marked it as the solution).

UserImage.jpg
Paul Davies

I've found it works better if on the OnParametersChange event as at onReady the input may not have the value.


2011-08-23 22-04-05
Tiago Simões
Staff
Solution

Just an update just to let everyone know that there is a Forge component for this that will allow you to stay away from having custom JavaScript directly in your apps (which is always a good practice):

Cheers,
Tiago Simões

UserImage.jpg
Shaun11

Thanks Tiago Simoes. It works for me as well :-)

2022-05-19 14-01-44
Varada Rajan

Very Useful straight forward Discussion, Thanks Tiago Simões  and Eduardo Jauch 

2022-07-08 12-35-50
Balaji Rajaram

Hai Tiago Simões

i follow your ideas all fine but i find some threads

i can choose first line is small type of text and another one line is huge type of text 

when i am save to db it will save normal type of text please refer the below images 

how to clear the issues kindly teach me.

 

2024-02-07 07-33-10
David Castro

How can we do it for emails in reactive? 

We cannot use inject html or html element blocks on reactive emails.

2018-03-28 15-07-25
Frank Sprengers

also looking forward to a solution for html in Email in Reactive

2024-02-07 07-33-10
David Castro

Please vote on this idea:

https://www.outsystems.com/ideas/11821/enable-using-html-content-in-email-body-in-reactive-app/

2018-03-28 15-07-25
Frank Sprengers

already had my vote, good for pointing it out!

2024-05-06 05-10-32
Sojanya Tripathi

I also second this idea as sometimes email templates needs to be managed using CMS part of the application.

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