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 wantLine ALine BWhen 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 valueThanks in advances
Hi,
can you try with this value set in site property.
"Line A" + NewLine() + "Line B"
thanks
cv
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 answersJohn
Hi john,
I attached the OML, check if you can use this way to achieve your goal.
Hope this will helps you!!
Regards,
Rajat
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.RegardsJohn
Hi John,
I updated OML please have a look now its using single Site property.
Hope this helps you!!!
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
I attached the OML, Please check it.
Hope this will help you!!
Thanks
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.
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>")
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.