Password Comfirm problems

Hey guys, I got some java script code that compares the strings in 2 text boxes and checks to see if they are identical, exactly
like when u change ur password and u have to type it again to confirm it. However with this code that i have, it tells the user that their password is invalid before they retype their password (but the code does what it is suppose to do ie compare the 2 strings).

To keep it simple as soon as the user tries to retype their password in the 2nd text box they get a alert saying that the password is invalid. I would be happy is any1 could look at my code and make some suggestions so that it compares the strings after the 2nd string has been entered in the 2nd tecx box.

thanx guys

heres the code:

function ValidatorCompare(operand1, operand2, operator, val) {
var dataType = val.type;
var op1, op2;
if ((op1 = ValidatorConvert(operand1, dataType, val)) == null)
return false;
if (operator == "DataTypeCheck")
return true;
if ((op2 = ValidatorConvert(operand2, dataType, val)) == null)
return true;
switch (operator) {
case "NotEqual":
return (op1 != op2);
case "GreaterThan":
return (op1 > op2);
case "GreaterThanEqual":
return (op1 >= op2);
case "LessThan":
return (op1 < op2);
case "LessThanEqual":
return (op1 <= op2);
default:
return (op1 == op2);
}
}

Comments

  • : Hey guys, I got some java script code that compares the strings in 2 text boxes and checks to see if they are identical, exactly
    : like when u change ur password and u have to type it again to confirm it. However with this code that i have, it tells the user that their password is invalid before they retype their password (but the code does what it is suppose to do ie compare the 2 strings).
    :
    : To keep it simple as soon as the user tries to retype their password in the 2nd text box they get a alert saying that the password is invalid. I would be happy is any1 could look at my code and make some suggestions so that it compares the strings after the 2nd string has been entered in the 2nd tecx box.
    :
    : thanx guys
    :
    : heres the code:
    :
    : function ValidatorCompare(operand1, operand2, operator, val) {
    : var dataType = val.type;
    : var op1, op2;
    : if ((op1 = ValidatorConvert(operand1, dataType, val)) == null)
    : return false;
    : if (operator == "DataTypeCheck")
    : return true;
    : if ((op2 = ValidatorConvert(operand2, dataType, val)) == null)
    : return true;
    : switch (operator) {
    : case "NotEqual":
    : return (op1 != op2);
    : case "GreaterThan":
    : return (op1 > op2);
    : case "GreaterThanEqual":
    : return (op1 >= op2);
    : case "LessThan":
    : return (op1 < op2);
    : case "LessThanEqual":
    : return (op1 <= op2);
    : default:
    : return (op1 == op2);
    : }
    : }
    :
    :
    You are probably checking the passwords if the content of the edits changes. You need to check it once the user is ready with typing his passwords. I would suggest that you call the validator, if the user wants to submit the new password and let the validator perform the actual submission after the validation checked out correctly.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion