Form Validation Code

Is there any Problem in the below JavaScript Form Validation Code

function validation() {

    var uName = document.querySelector('#user').value;

    var email = document.querySelector('#mail').value;

    var pas = document.querySelector('#pass').value;

    var cPas = document.querySelector('#cPass').value;

    var ucheck = /^[a-zA-Z0-9]{3,15}$/;

    var cmail = /^[a-zA-Z0-9_.-]{3,}@[A-Za-z0-9]{2,6}[.]{1}[a-zA-Z.]{2,9}$/;

    var cpas = /(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])[A-Z]{1}[a-z0-9!@#$%^&*]{5,20}$/

    if (ucheck.test(uName)) {

        document.querySelector('#uError').innerHTML = "";

    } else {

        document.querySelector('#uError').innerHTML = "Please Enter Corrent User Name";

        return false;

    }

    if (cmail.test(email)) {

        document.querySelector('#mError').innerHTML = "";

    } else {

        document.querySelector('#mError').innerHTML = "Please Enter Your Email Address";

        return false;

    }

    if (upas.test(pas)) {

        document.querySelector('#pError').innerHTML = "";

    } else {

        document.querySelector('#pError').innerHTML = "Password Length 5-20 Camel Case Alpha Num with Special Char";

        return false;

    }

just wonder if there was any error when you run this code?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.