103
Views
10
Comments
Line break in Site properties
Application Type
Traditional Web, Reactive

Hey guy, i have this text Site properties with some text in it, i used it to print error onto the screen. I wanted to ask how can i add line break into it? This is what i want
Line A
Line B
When i add a NewLine() function like this (Line A + NewLine() + Line B )it pop up and error saying "Default value" must be set to a "Text" literally value
Thanks in advances

2024-03-22 09-17-23
Chandra Vikas Sharma

Hi,

can you try with this value set in site property.

"Line A" + NewLine() + "Line B" 


thanks

cv

UserImage.jpg
Long Truong Hoang

Yes i have try your method as I has stated on the caption. It will pop up an error require literal text only, mean no expression is allowed.
Thanks for your answers
John

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi john,

I attached the OML, check if you can use this way to achieve your goal.

Hope this will helps you!!



Regards,

Rajat

TestingDemo.oml
UserImage.jpg
Long Truong Hoang

Thank you for your method. But the client require there will be only one site properties only. I have already propose the ideal of combine 2 separate site properties together and add an LineBreak in between but unfortunately they don't agree on that.
Regards
John 

2020-07-21 19-28-50
Rajat Agrawal
Champion

Hi John,

I updated OML please have a look now its using single Site property.


Hope this helps you!!!


Regards,

Rajat

TestingDemo.oml
2025-02-10 17-24-13
Arun Rajput

Hi John Cop,

You can achieve this by using <br> tag in site property

You have to given value to site property like below 

LineA +"<br>"+LineB

Now use this site property value inside html widget.

If you are working in traditional application then use it directly inside the expression and make escape content property to yes of that expression and if you are using it reactive then you can use InjectHTML forge component for achieving same


-Arun

2024-08-08 11-25-20
Santhosh Mathivanan

Hi John,

I attached the OML, Please check it.

Hope this will help you!!



Thanks




ErrorMessage.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi John,

In my opinion it's better to not include the newline directly in the site property, but use another symbol, like "|", to denote the line break, and then use a Replace() to replace the symbol with a NewLine().

So your site property is e.g. "Line1|Line2", and then you do a Replace(Site.MyMessage, "|", NewLine()) before displaying it.

2024-07-09 06-45-01
Adarsh

Hi John,


For the default value of the Site Property, you can set it like this:

"Line A\nLine B"

This will store the newline character in the text, but to display it properly in your UI, you need to ensure that the UI component handling the output interprets the line breaks correctly.

When displaying the Site Property value, if you're using a text widget, OutSystems doesn't automatically render \n as an HTML line break (<br>). So, you’ll need to replace \n with <br> for it to display correctly.

You can achieve this using an expression to replace the newline characters:

Replace(Site.PropertyText, "\n", "<br>")


2024-09-10 03-15-20
Tegar

You can save your text content along with HTML tags (e.g., `<br>` for line breaks). To render or display it on the screen, use `SetContainerHTML`. This will parse the HTML tags and render them correctly in the display.

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