hi all,
I'm working on validating a username and password.... heres what I have so far.... i know the validation falls down when im trying to check the format of the password...
Code:
function fnValidate(jsValidationType, Action, type, page, db)
{
switch(jsValidationType)
{
var re = /^\w*(?=\w*\d)(?=\w*[a-z])(?=\w*[A-Z])\w*$/;
case 'Account': if (document.REG_FORM.USER_NAME.value.length < 6)
{
alert ("Please enter username at least 6 characters in length");
//document.REG_FORM.USER_NAME.style.borderStyle = "dotted";
//document.REG_FORM.USER_NAME.style.borderColor = "red";
document.REG_FORM.USER_NAME.focus();
return false;
}
#####falls down here i think#################
if (document.REG_FORM.USER_NAME.value != re)
{
alert ("The username you have entered does not follow the correct format - for security reasons, this must be at least 6 characters in length, containing letters (upper & lowercase) plus one or more numbers and/or symbols, e.g. âUsern@meâ or âUsername1â");
//document.REG_FORM.USER_NAME.style.borderStyle = "dotted";
//document.REG_FORM.USER_NAME.style.borderColor = "red";
document.REG_FORM.USER_NAME.focus();
return false;
}
#########################################################
if (document.REG_FORM.PASSWORD.value.length < 6)
{
alert ("Please enter password at least 6 characters in length");
document.REG_FORM.PASSWORD.focus();
return false;
}
if (document.REG_FORM.PASSWORD.value != document.REG_FORM.PASSWORD_CHECK.value)
{
alert ("The password you entered does not match your first entry. Please try again");
document.REG_FORM.PASSWORD_CHECK.value = "";
document.REG_FORM.PASSWORD.value = "";
document.REG_FORM.PASSWORD.focus();
return false;
}
fnFireCREvent(Action, type, page, db);
break;
}
}
Hope someone can help....
Cheers,
My new web design domain
www.askmultimedia.co.uk