[RESOLVED] About date validation(regexp)
I want to validate whether the date(day) user input is correct format or not, but the code seems wrong, it displays "invalid" all time...
in js:
Code:
function validateCc3() {
if (document.loginform.cc3.value == "") {
errorMessage(document.loginform.cc3, "can't be blank");
return false;
}
else {
var cc3_regexp = /0[1-9]|[12][0-9]|3[01]/;
var cc3 = document.loginform.cc1.value;
var valid = cc3_regexp.exec(cc1);
if (!valid) {
errorMessage(document.loginform.cc3, "invalid");
return false;
}
else {
removeErrorMessage(document.loginform.cc3);
return true; }
}
}
html:
Code:
<input class="requiredshort" type="text" id="cc3" name="cc3" maxlength="2" size="4" onblur="validateCc3();">