I can get a label to render html if I put some html in the text property at design time. However, if I set the text property with the exact same data at runtime, it will not render the html. It just strips out the html and prints the plain text. The same thing happens if I give the label a dataprovider that has html in it. It just strips out the html and prints plain text.
Is there some sort of standard or set of rules that determine when a label will render the html and when it will not? Or is this a bug?
I am using webclient by the way.
Hi,
I just tested it in Servoy 6.1 and it works fine for me.
Can you show how you set your label and what does the HTML look like ?
After performing some more investigating, it appears that SOME of the tags continue to work. Not all of them though. See my code below:
var labelDP = "<html><div style='width:50%;'>abcdefghijklmnopqrstuvwxyz 0123456789
abcdefghijklmnopqrstuvwxyz 0123456789 abcdefghijklmnopqrstuvwxyz 0123456789
abcdefghijklmnopqrstuvwxyz 0123456789 abcdefghijklmnopqrstuvwxyz 0123456789 abcdefghijklmnopqrstuvwxyz 0123456789 </div></html>"
function onLoad(event)
{
elements.label3.text = labelDP
}
So in my project I have 3 labels. The first one has the contents of the labelDP variable literally copied and pasted into the text property in the designer. The second label uses labelDP as its dataprovider. The third label relies on the onLoad function to change the text property of the label with javascript. Since all 3 labels have the exact same html string, I would think they would all render identically. They do not. On labels 2 and 3, the div tag width is ignored. Also, text does not wrap. Label 1 will render div tag width properly, and will also wrap text even if a div tag is not used.
The whole reason I want this to work is to automatically wrap text.
labelHTMLRender.servoy (4.27 KB)
I wrote up this bug report for this issue: https://support.servoy.com/browse/SVY-3279