Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Dev_Brooke
Posts: 17
Registered: ‎06-19-2013
My Device: BlackBerry Z10
Accepted Solution

Creating html link in Label with text containing &

Hi,

 

I have a label and set it's text with a string surrounded by html and a tags and this usually works fine but if the string contains & character then it doesn't display correctly.

 

Is there a way to fix this?

Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: Creating html link in Label with text containing &

& is a special symbol in HTML, chek it out:

http://www.w3schools.com/tags/ref_ascii.asp

 

You have to put & instead.

Contributor
Dev_Brooke
Posts: 17
Registered: ‎06-19-2013
My Device: BlackBerry Z10

Re: Creating html link in Label with text containing &

Thanks for replying.

 

I'm trying .replace("&", "&") but & appears in the txt rather than &.

 

Any ideas?

Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: Creating html link in Label with text containing &

Could you post your QML?

I just had the same issue yesterday and it worked for me.

Contributor
Dev_Brooke
Posts: 17
Registered: ‎06-19-2013
My Device: BlackBerry Z10

Re: Creating html link in Label with text containing &

I'm returning the string back to qml from c++ to be displayed - how did you do it with qml?

Developer
Hithredin
Posts: 404
Registered: ‎06-03-2010
My Device: Z10 Red

Re: Creating html link in Label with text containing &

I also used setText() from C++, But I'd like to see the property of your Label

Contributor
Dev_Brooke
Posts: 17
Registered: ‎06-19-2013
My Device: BlackBerry Z10

Re: Creating html link in Label with text containing &

My problem was actually because my html tags were being inserted in the wrong places due to increasing number of characters when replace happens.

 

All sorted now.

 

Thanks a lot for your help.