I am currently testing out JavaScript form validation. The information provided is not being sent to any database, it's just for format testing purposes. All the regex checks are functioning correctly apart from birth.
It seems like there may be an issue with the regex check related to birth because when I added another check using a different format, it worked fine. The goal is for users to input their birthday in the mm/dd/yyyy format and receive the appropriate error message if not formatted correctly. Any assistance on this matter would be greatly appreciated!
if(birth == "") {
printError("birthErr", "Please enter your birthday");
} else {
var regex = '/^((0?[1-9]|1[012])[- /.](0?[1-9]|[12][0-9]|3[01])[- /.](19|20)?[0-9]{2})*$/';
if(regex.test(birth) === false) {
printError("birthErr", "Please enter a valid birthday");
} else {
printError("birthErr", "");
birthErr = false;
}
}