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

Adobe AIR Development

Reply
Contributor
shevbg
Posts: 33
Registered: ‎01-15-2011
My Device: Not Specified

Hyperlink in AlertDialog

Hello, 

 

I have an AlertDialog pop-up with some regular text, part of which is a link to a website. I therefore added the text with HTML using messageHtml as such:

 

 

alertDialog.messageHtml = "<p> Some Text "<br />
 <a href=\"www.website.com\"> www.website.com </a> </p>";

 

 

However, when I run this in the simulator (newest version - 0.9.3), the website does not appear as a hyperlink, and you cannot click it. 

 

Am I doing this correctly? The reason I ask is because I heard that an App has gotten rejected due to a website not being written as a hyperlink. Perhaps it does not appear as a hyperlink in the simulator, but it will on the actual device? 

 

Any help would be appreciated!

 

Thank you!

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Hyperlink in AlertDialog

Not all HTML is supported in the dialog class package.  You will need to verify that the hyperlink tag (A) is supported.  Also, try adding a target for the HREF ("_blank") to see if that would do it.

Contributor
shevbg
Posts: 33
Registered: ‎01-15-2011
My Device: Not Specified

Re: Hyperlink in AlertDialog

Adding a "_blank" target for the href did not work unfortunately. I have been unable to find specific documentation regarding supported HTML for the alertdialog class package, but it seems that it is not supported...

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Hyperlink in AlertDialog

It "may" in the next release because there were no obvious enhancements to the Dialog package at the same time we received a browser with the OS.  My guess is that it was not a requirement to support that tag in HTML.  You can add a button to the dialog to browse to some site using navigateToURL.

Contributor
shevbg
Posts: 33
Registered: ‎01-15-2011
My Device: Not Specified

Re: Hyperlink in AlertDialog

Thank you for your response again.

 

Basically there is an "info" button in my app that pops up an alertDialog box. There I list some contact information, such as e-mail addreses. I just want to make sure that BB would not reject the app simply because those are not hyperlinks. I also have a "rules" button that pops up an alertDialog with the rules of the game, and then I provide the website on the bottom to cite where the rules came from. As far as I'm concerned, it does not matter to me if the site is a hyperlink. However, I feel as if BB may reject it simply because of that. Can you give me any suggestions on that? Or perhaps another way to present the "rules" and "info" to the user instead of alertDialog boxes?

 

Thank you!

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Hyperlink in AlertDialog

Problem with a hyperlink, you are then requiring the person to be connected to the internet to view these items.  You could have a button that does a navigateToURL to a local "rules.html" file that was installed with your app.

Contributor
shevbg
Posts: 33
Registered: ‎01-15-2011
My Device: Not Specified

Re: Hyperlink in AlertDialog

Thank you, this is what I am trying to do now.

 

However, for the life of me, I cannot get the navigateToURL() to work with a local file. I feel as if I have exhausted all the possible syntax, but it just will not load the local file. I can get it to work no problem with a http site however.

 

Any help would be great! Thank you again!

Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10

Re: Hyperlink in AlertDialog

There are some threads on this.  It was something like:

 

file://path/rules.html

 

I cant recall if it was just file:// or file:///

 

 

 

 

Developer
tensioncore
Posts: 326
Registered: ‎12-13-2010
My Device: Bold 9900/Z10 Special Edition

Re: Hyperlink in AlertDialog

If you really wanted to continue this direction and have a website opened in the browser, you could add an eventListener that Invokes the browser after a button in the alert is pressed.
CEO/Lead Developer - Tensioncore™ Design Studios
http://tncr.ws/ - ShortenThis!™ for Blackberry Playbook | ShortenThis!™ for BlackBerry® 10
The Periodical Toe A highly informative Table of Elements
DrawThis! A fun drawing app for the BlackBerry® PlayBook™!
http://www.tensioncore.com/ - Tensioncore™ Web Hosting
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)

Re: Hyperlink in AlertDialog

@jtegen It was file://

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!