Please I am trying to write a code that checks whether a users input is a valid input or not in QT quick.
I want it to check and if it does not fulfill the usual email format not allow user to submit but notify him that the email is wrong.
I have seen samples for php and some c++ but from my experience, I cannot really work in qt quick the way I would when using Qt C++ line edit methods so was wondering if anyone has tried this out.
Thanks in advance.
Use this EMail validation javascript code
function validateForm(email)
{
var atpos=email.indexOf("@");
var dotpos=email.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length)
{
//Not a valid e-mail address
return false;
}
}
Read this to see how you can import javascript into QML