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

Reply
Developer
Posts: 117
Registered: ‎02-12-2009
My Device: Not Specified
Accepted Solution

onClick JavaScript event not fired on using Enter key

Hi All,
 
I am facing a strange issue. I have a form in which I have written a javascript form validation function to validate the blank fields. This function is called on click of Submit button.
 
Now when we are using mouse/touch to click the Submit button, there is no issue. OnClick event is fired.
 
But when user clicks a textfield and then presses enter key. OnClick event is not fired, form is submitted without validating it.
 
This is happening on Blackberry. It worked fine on Android, iPhone simulator.
 
Just to check it is working fine on Firefox but not on IE.
 
If any one has any pointers, please help.
 
Thanks and regards,
Sandeep
Highlighted
Developer
Posts: 128
Registered: ‎08-01-2008
My Device: Bold 9900, 9810, 9780, 9650 and so many others
My Carrier: T-Mobile

Re: onClick JavaScript event not fired on using Enter key

Not really a solution, more of a workaround but can you use onKeyUp to trap the Enter press?

Secondly, Isn't there an onSubmit event you should subscribe to for validation of a form?
Developer
Posts: 117
Registered: ‎02-12-2009
My Device: Not Specified

Re: onClick JavaScript event not fired on using Enter key

onSubmit did the trick. May be Blackberry browser behaves in different manner as compared fo browsers of other manufacturers.

 

Thanks,

Sandeep