Thank you, Bj -- finally got it to work, but now browser is only detecting
blank_fields if all blank fields are empty. If only one (of the two)
fields are empty it still returns true. Seems like this is something
simple but I can't see it...Thanks, Alan
var errors = "";
function checkChar(v) {
var illegalChars = /\W/; // allow letters, numbers, and underscores
if ((v.length < 6) || (v.length > 13) || illegalChars.test(v)) {
errors = "Valid usernames and passwords consist of 6 to 13 letters
or numbers.";
}
return errors;
}
// returns true if the string contains only whitespace characters
function isBlank(s) {
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if ((c != ' ' ) && (c != '\n') && (c != '')) return false;
}
return true;
}
// invoked by the onsubmit event handler
function verify(f) {
var msg;
var empty_fields = "";
for (var i = 0; i < f.elements.length-1; i++) {
var e = f.elements[i];
if ((e.value == null) || (e.value == "") || isblank(e.value)) {
empty_fields += e.name + "\n";
}
checkChar(e.value);
}
if (!empty_fields && !errors) return true;
msg = "_______________________________________\n\n"
msg += "Login could not be performed.\n";
msg += "Please correct the following and re-submit.\n";
msg += "_______________________________________\n\n"
if (empty_fields) {
msg += "The following required fields are empty:" + "\n"
+ empty_fields + "\n";
if (errors) msg += "\n";
}
msg += errors;
alert(msg);
return false;
}
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]