ValidationEngine密码验证问题

时间:2013-07-29 06:33:21

标签: jquery validation jquery-validation-engine

我正在使用jquery validationEngine进行表单验证。但我无法验证表单验证密码字段。它只是说“字段不匹配”,而我输入相同的密码以及验证密码字段。这是我的代码,

<link href="/js/jq_validation/validationEngine.jquery.css" rel="stylesheet" type="text/css" media="screen" />

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>  
<script src="/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine-en.js" type="text/javascript" ></script>
<script src="/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine.js" type="text/javascript" ></script>
<script>
$(document).ready(function(){
    $(".test2").validationEngine();
});
</script>


<!---<script src="{$strREQUEST_URI}/img/shop/local.glasses2020.co.uk/contents/js/jquery.validationEngine_old.js" type="text/javascript" ></script>-->


        <form method="post" action="{$strSecureREQUEST_URI}/register?{$smarty.server.QUERY_STRING}" id="registerform1" name="registerform" class="test2">
            <div class="fname">
                <div class="txtl">Username:<span style="color:red;">&nbsp;*</span></div>
                    <div class="field">
                        <input type="text" class="validate[required,length[0,100]] textfield" value="" name="user" id="user" data-errormessage-value-missing="* Username is required!" data-errormessage-custom-error="Let me give you a hint: someone.noone"  />
                    </div>
            </div>
            <div class="fname">
                <div class="txtl">Password:<span style="color:red;">&nbsp;*</span></div>
                    <div class="field">
                        <input type="password" class="validate[required] text-input" value="" name="pass" id="password2" data-errormessage-value-missing="* Password is required!"  />
                    </div>
            </div>
            <div class="fname">
                <div class="txtl">Verify Password:<span style="color:red;">&nbsp;*</span></div>
                    <div class="field">
                        <input type="password" class="validate[required,equals[password2]] text-input" value="" name="vpass" id="vpass" data-errormessage-value-missing="* Verification Password is required!"  />
                    </div>
            </div>
        </form>

请帮我解决问题!

3 个答案:

答案 0 :(得分:1)

行。我遇到了这个问题。我使用旧版本的验证引擎文件。所以我更新了我的文件,它的工作原理。此外,请注意形式和元素ID。他们应该是不同的。另外,参考上面的“Aritra Chakraborty”答案,名称和id不必相同。请注意,如果您有多个带密码的表单并验证密码文件,请确保如果多个表单提交到同一链接并且ID应该不同,则名称应保持相同!

答案 1 :(得分:0)

我认为你的

name="pass" id="password2"

应该像

一样
name="password2" id="password2"

在密码提交中。如果您遇到任何问题,请告诉我。

<强>更新

我从你的代码中得到的唯一问题是

<input type="password" class="validate[required] text-input" value="" name="pass" id="password2" data-errormessage-value-missing="* Password is required!"  />

应该像

<input type="password" class="validate[required] text-input" value="" name="password2" id="password2" data-errormessage-value-missing="* Password is required!"  />

答案 2 :(得分:0)

要检查确认密码最低字符验证,您可以使用

tracks