The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 783 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/showthread.php 26 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.28 (Linux)
File Line Function
/global.php 909 errorHandler->error
/showthread.php 26 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/showthread.php 26 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/showthread.php 137 forum_permissions
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1380 fetch_forum_permissions
/inc/functions.php 2909 forum_permissions
/showthread.php 621 build_forum_jump
Warning [2] Undefined array key "mybb" - Line: 1952 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 1952 errorHandler->error
/inc/functions_indicators.php 41 my_set_array_cookie
/showthread.php 629 mark_thread_read
Warning [2] Undefined property: MyLanguage::$ratings_update_error - Line: 5 - File: showthread.php(732) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/showthread.php(732) : eval()'d code 5 errorHandler->error
/showthread.php 732 eval
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions_user.php 844 is_member
/inc/functions_post.php 406 purgespammer_show
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "profilefield" - Line: 6 - File: inc/functions_post.php(474) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php(474) : eval()'d code 6 errorHandler->error
/inc/functions_post.php 474 eval
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "canonlyreplyownthreads" - Line: 660 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 660 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showimages" - Line: 741 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 741 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "showvideos" - Line: 746 - File: inc/functions_post.php PHP 8.1.28 (Linux)
File Line Function
/inc/functions_post.php 746 errorHandler->error
/showthread.php 1070 build_postbit
Warning [2] Undefined array key "invisible" - Line: 1506 - File: showthread.php PHP 8.1.28 (Linux)
File Line Function
/showthread.php 1506 errorHandler->error
Warning [2] Undefined variable $threadnotesbox - Line: 30 - File: showthread.php(1533) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 30 errorHandler->error
/showthread.php 1533 eval
Warning [2] Undefined variable $addremovesubscription - Line: 79 - File: showthread.php(1533) : eval()'d code PHP 8.1.28 (Linux)
File Line Function
/showthread.php(1533) : eval()'d code 79 errorHandler->error
/showthread.php 1533 eval



FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
RSV Custom Validation - Match password
#1
Hi,

I am using the RSV method to validate 3 fields. But I am having an issue with the way the code finds the form fields.

The code below splits the values for each rule in myRules, (se var parts), then gets the fieldnames based on the second item in each rule. Now, when I try to use 'same_as' for my second password field 'rootpassword2', I have to specify 'rootpassword' as the second item in the rule:

var myRules = [
"required,hostname,Host Name Required",
"required,rootpassword,Password Required",
"same_as,rootpassword,rootpassword2,Password Must Match"
];

The problem is that the code...

var parts = myRules[i].split(",");
var fieldName = parts[1];

... uses the second value in the rule, bypassing the actual fieldname 'rootpassword2'.

Any help you can provide to fix the issue is greatly appreciated.



PHP Code:
jQuery.noConflict();

// a custom onComplete handler to prevent form submits for the demo
function myOnComplete()  {
    
alert("The form validates!");
    return 
false;
}

/**
 * My custom error message handler. This displays each error message next to
 * each field. It assumes there are hidden fields
 */
function myCustomErrorDisplayFunction(ferrorInfo){
        
// disabled all errors by default
        
for (var i=0i<myRules.lengthi++)        {
                var 
parts myRules[i].split(",");
                var 
fieldName parts[1];

                
document.getElementById(fieldName "_label").className "";
                
//document.getElementById(fieldName + "_error").style.display = "none";
        
}

        for (var 
i=0i<errorInfo.lengthi++)        {
                var 
fieldName;

                
// radio button
                
if (errorInfo[i][0].type == undefined)
                        
fieldName errorInfo[i][0][0].name;
                else
                        
fieldName errorInfo[i][0].name;

                
// display the error
                
document.getElementById(fieldName "_label").className "sa-hot";
                
//document.getElementById(fieldName + "_error").style.display = "block";
               // document.getElementById(fieldName + "_error").innerHTML = errorInfo[i][1];
        
}

        
// normally, we'd do something like this: only return TRUE if there were no errors.
        // but this is just a demo. so it's commented out.
        //return (errorInfo.length == 0) ? true : false;

        
if (errorInfo.length == 0)
                
alert("Form submitted here!");

        return 
false;
}

var 
myRules = [
        
"required,hostname,Host Name Required",
        
"required,rootpassword,Password Required",
        
"same_as,rootpassword,rootpassword2,Password Must Match"
];

jQuery(document).ready(function() {
        
jQuery("#sa_form").RSV({
                
onCompleteHandlermyOnComplete,
                
customErrorHandlermyCustomErrorDisplayFunction,
                
rulesmyRules
        
});
});[/
php 
]
Reply
#2
Hi,

Just a couple of quick thoughts. Have you actually tested using the same_as rule and found that it isn't working? I haven't had to use this rule myself yet, but thinking about how the rest of the validation works it doesn't matter that it is using the first fieldname (password) again as you can have multiple validation rules against one fieldname.

Rooting through the rsv.js file I found the following:

Code:
case "same_as":
        if (form[fieldName].value != form[fieldName2].value)
        {
          if (!rsv.processError(form[fieldName], errorMessage))
            return false;
        }
        break;

Which seems to suggest it will correctly compare the two values.

Hope that helps!

Martin
Reply
#3
Hi, there is nothing wrong with save_as. That part works. As I mention in my post, this is related to the placement of the field to check against. Since the fielDname is placed as the second value in the rule, the code actually highlights the first password field when the fields don't match. Is there another way to define the fieldnames?

//thanks
Reply
#4
(Mar 3rd, 2010, 1:20 AM)perfectpixel Wrote: Hi, there is nothing wrong with save_as. That part works. As I mention in my post, this is related to the placement of the field to check against. Since the fielDname is placed as the second value in the rule, the code actually highlights the first password field when the fields don't match. Is there another way to define the fieldnames?

//thanks
Sorry - I misunderstood. Aside from doing something clever so that the error formating is applied to the second value (guess this could be done in the script), the other route would be to define a custom validation rule (as shown in the docs), that would more flexibility.
Reply
#5
Hey guys,

Yeah - if I understand this properly, I think Martin's right: you'd probably need a custom rule to change the focus behaviour. I guess just switching rootpassword and rootpassword2 in the same_as rule wouldn't work?

But just so I'm totally clear: the problem is usability; you think that in the case of someone entering two different passwords should validate by always focusing on the FIRST password field? I gotta say, that sounds pretty reasonable to me... I wouldn't object to updating the script to behave like that.

- Ben
Reply
#6
Hi,

actually, the issue is with the way this example code has been constructed. The values In the rules are separated by commas and the script looks for the second value in each rule for the fieldnames. As such, the second value in the same_as rule is the same as the field to match against. The same_as rule should be applied in a different way, maybe like so same_as[fieldname] instead of same_as, fieldname.

Just a thought. As is, the custom example is flawed, since the second value in the same_as rule is the field to match against. Thus it won't return a rule that corresponds to the second field.





(Mar 7th, 2010, 11:21 AM)Ben Wrote: Hey guys,

Yeah - if I understand this properly, I think Martin's right: you'd probably need a custom rule to change the focus behaviour. I guess just switching rootpassword and rootpassword2 in the same_as rule wouldn't work?

But just so I'm totally clear: the problem is usability; you think that in the case of someone entering two different passwords should validate by always focusing on the FIRST password field? I gotta say, that sounds pretty reasonable to me... I wouldn't object to updating the script to behave like that.

- Ben
Reply
#7
Hey perfectpixel,

I'm sorry, I guess I'm just not following your explanation of the problem... Martin, if I'm being totally daft, do chime in.

Quote:As such, the second value in the same_as rule is the same as the field to match against.

No, I don't think so... the same_as rule works properly. I've actually used it for several years now and it still appears to be working fine.

Sorry for not following! Could you maybe post a link to the form so I could look at it directly?

- Ben
Reply
#8
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.

I think you have a great script, but I never got it to do what I wanted due to this issue. So I abandoned it. I'd love to use it, if the custom example is fixed Smile

Thanks!

(Mar 7th, 2010, 7:27 PM)Ben Wrote: Hey perfectpixel,

I'm sorry, I guess I'm just not following your explanation of the problem... Martin, if I'm being totally daft, do chime in.

Quote:As such, the second value in the same_as rule is the same as the field to match against.

No, I don't think so... the same_as rule works properly. I've actually used it for several years now and it still appears to be working fine.

Sorry for not following! Could you maybe post a link to the form so I could look at it directly?

- Ben
Reply
#9
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.


(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.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)