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

Web and WebWorks Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

Giving Focus to Textarea inside Top Layer Div

I'm trying to give focus to a textarea inside a div that is on top of another div. This is how it goes div#container is the bottom div whereby it will list out rows of records from database and there will be a link for users to click on ADD.

 

strBtmDiv += '<div id="container">';
strBtmDiv += '<table id="tablePending">';
strBtmDiv += '<tr>';
strBtmDiv += '<td>Detail One</td><td>Detail Two</td><td>Detail Three</td><td 
onclick="showDialog()">ADD</td>';
strBtmDiv += '</tr>';
strBtmDiv += '</table>';
$('#mainBody').html(strBtmDiv);

 When user clicks on ADD onclick will fire another function showDialog() that displays a textarea and submit button for user to submit the addedd text.

 

strDialog += '<div id="overlay">';
strDialog += '<table id="tblDialog">';
strDialog += '<tr>';
strDialog += '<td><textarea id="textRemark" cols="10" rows="5"></textarea></td><td><input type="submit" value="Submit"></td>
strDialog += '</tr>';
strDialog += '</table>';
strDialog += '</div>';
$('#container').after(strDialog);

setTimeout(function () {blackberry.focus.setFocus('textRemark'); }, 300);

 

showDialog()/div#overlay will be added after the div#container and then using css z-index so div#overlay will appear on top of div#container. I have tried to set focus to the textarea using setTimeout(function () {blackberry.focus.setFocus('textRemark'); }, 300) but it is not working. Can anyone please help?

 

Thank you.

New Contributor
Posts: 8
Registered: ‎10-20-2012
My Device: Playbook
My Carrier: Rogers

Re: Giving Focus to Textarea inside Top Layer Div

Have you tried something like...

 

function getfocus()
{
document.getElementById('textRemark').focus()
}

Developer
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

Re: Giving Focus to Textarea inside Top Layer Div

Thank you. It's working.

 

But how do I use blackberry.focus.setFocus?

Highlighted
New Contributor
Posts: 8
Registered: ‎10-20-2012
My Device: Playbook
My Carrier: Rogers
Developer
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800
My Carrier: DiGi

Re: Giving Focus to Textarea inside Top Layer Div

Thanks for the link but is there any examples to show how to use them?

New Contributor
Posts: 8
Registered: ‎10-20-2012
My Device: Playbook
My Carrier: Rogers

Re: Giving Focus to Textarea inside Top Layer Div