This function seems to work except for the checking for a string that contains letters and at least one number. please help?
function ValidatePW() {
var error = "";
var illegalChars = /[\W_]/; // allow only letters and numbers
var fld = document.updateForm.tUserPassword
if (fld.value == "") {
fld.style.background = 'Yellow';
alert("You didn't enter a password.\n");
} else if ((fld.value.length < 8) || (fld.value.length > 15)) {
alert("The password must be a minimum of eight characters.");
fld.style.background = 'Yellow';
} else if (illegalChars.test(fld.value)) {
alert("The password contains illegal characters, enter letters and numbers only.");
fld.style.background = 'Yellow';
} else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
alert("The password must contain at least one number.");
fld.style.background = 'Yellow';
} else {
fld.style.background = 'White';
}
}
function ValidatePW() {
var error = "";
var illegalChars = /[\W_]/; // allow only letters and numbers
var fld = document.updateForm.tUserPassword
if (fld.value == "") {
fld.style.background = 'Yellow';
alert("You didn't enter a password.\n");
} else if ((fld.value.length < 8) || (fld.value.length > 15)) {
alert("The password must be a minimum of eight characters.");
fld.style.background = 'Yellow';
} else if (illegalChars.test(fld.value)) {
alert("The password contains illegal characters, enter letters and numbers only.");
fld.style.background = 'Yellow';
} else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
alert("The password must contain at least one number.");
fld.style.background = 'Yellow';
} else {
fld.style.background = 'White';
}
}