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

Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Email validation into TextField

[ Edited ]



      Any idea how to validate email in TextField?




Posts: 16
Registered: ‎05-26-2013
My Device: Z10
My Carrier: UAE DU

Re: Email validation into TextField



 Have you figured out how to  validate an email?

Posts: 17,019
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Email validation into TextField

you can compare the old text and the new text using a regular expression. if the result is false, replace the new with the old text.
I do that in Qt, but it should also be available in QML, see
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Posts: 180
Registered: ‎12-09-2011
My Device: 9360, BB10
My Carrier: Aircel

Re: Email validation into TextField

Try this may be it will help you..


function validEmail(emailId) {
var reg = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (emailId.length > 0 && reg.test(emailId)) {
return true;
return false;

Posts: 749
Registered: ‎12-16-2008
My Device: BlackBerry Z30
My Carrier: Bell

Re: Email validation into TextField

Validating emails is actually super complex, and most regular expressions are too restrictive. For example, having example+somestuff@somedomain.com is a vaild address that is often rejected.




Honestly, something simple like just making sure it has an @ symbol in it is probably enough. How valid do you really need it to be? At the end of the day, only way you can really be sure it's correct is to send an email to that address.

Paul Bernhardt
Application Development Consultant

Did this answer your question? Please accept this post as the solution.
Found a bug? Report it to the Developer Issue Tracker