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

Regular Contributor
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800

BB10 - Cannot type in Textbox after Alert Prompt

Hi all. I have problem with a validation function. The validation function will check for empty text box and alert the user regarding the empty field. Once user has clicked on 'OK' focus will be place in the text box. But when I test it out I could not type anything in the textbox even there's focus and cursor in the textbox.


The text box and submit button:


strDetailClaim += '<div class="detailsRow">';
 strDetailClaim += '<div class="detailsLabel">GL CODE</div><div 
 class="detailsValue"><input type="text" id="glCode_'+i+'"  
 name="glCode_'+referenceNo+'" size="9" value="'+detailsGLCode+'"></div>';

 strDetailClaim += '<span class="spanApprove"><button id="approveButton"   
 class="formButton" type="button" ontouchstart="shadowHighlight(this)" 
 ontouchend="noShadowHighlight(this); setTimeout(function()

 The approveClaim function:


alert("GL Code for claim number " + indieClaim[referenceNo].details[i].runno + " must  
 not be empty. Please key-in GL Code");
 return false;

 There one strange whereby if I remove alert box then user can type in the textbox but the alert box is needed to notify user on the empty field.


In one of the apps for OS 7, I use blackberry.focus.setFocus('id') to make it work but in OS 10 Focus API is not supported. 


Is there any workaround to allow alert box and place focus in the textbox and then allow user to type in the textbox?


BlackBerry Development Advisor
Posts: 832
Registered: ‎07-15-2008
My Device: Passport
My Carrier: Bell

Re: BB10 - Cannot type in Textbox after Alert Prompt

Hi, there's nothing that I can see in the code you posted which would cause a problem. Calling focus() is the right thing to do. However, setting the focus or not should have no bearing on whether you can input data into the field. I believe there is something else broken that is stopping this from working.

Tim Windsor
Open Source Technical Lead
Regular Contributor
Posts: 79
Registered: ‎09-17-2012
My Device: Torch 9800

Re: BB10 - Cannot type in Textbox after Alert Prompt

Oh dear, that would be hard to track. Maybe I'll try another alternative to alert users. :smileysad:

BlackBerry Development Advisor
Posts: 620
Registered: ‎10-01-2009
My Device: Z10

Re: BB10 - Cannot type in Textbox after Alert Prompt

I'd recommend toasts, or native dialogs rather than 'alerts', both of which are described here: https://developer.blackberry.com/html5/apis/bb10_index.html



Chad Tetreault | App Development Consultant | BlackBerry Developer Relations | developer.blackberry.com | @chadtatro