Mar 9th, 2010, 2:42 PM
Just interested in understanding the issue here. I've read this thread several times and I still can't see what the problem is!
The sameas rule compares (in the example you quote) rootpassword and rootpassword2. If rootpassword2 doesn't match rootpassword then the error message will be flagged against rootpassword. As mentioned above, if this is the issue you could create a custom rule that focuses on rootpassword2.
The format of the rule (ie second value in rule) doesn't overide the fact that rootpassword2 still gets tested. Provided your error message says 'both passwords must match' or something of that ilk, this will work perfectly from a user's perspective.
The sameas rule compares (in the example you quote) rootpassword and rootpassword2. If rootpassword2 doesn't match rootpassword then the error message will be flagged against rootpassword. As mentioned above, if this is the issue you could create a custom rule that focuses on rootpassword2.
The format of the rule (ie second value in rule) doesn't overide the fact that rootpassword2 still gets tested. Provided your error message says 'both passwords must match' or something of that ilk, this will work perfectly from a user's perspective.
(Mar 7th, 2010, 11:11 PM)perfectpixel Wrote: The problem is here:
The custom validation gets the fieldname to validate from the second value of each rule (var fieldName = parts[1]; ) And if you look at the code below, the second value is the same for both rootpassword, and rootpassword2. The correct field would be rootpassword2 (marked in green below).
var myRules = [
"required,rootpassword,Password Required",
"same_as,rootpassword,rootpassword2,Password Must Match"
];
var parts = myRules[i].split(",");
var fieldName = parts[1];
Since the same_as function gets which field to match against from the variable placed right after it, after the comma (marked in red above), your example becomes flawed. The rule for the same_as line above will never return an error message for rootpassword2.