0

我正在使用 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>

请帮我解决问题!

4

3 回答 3

1

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

于 2013-07-30T08:22:02.197 回答
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!"  />
于 2013-07-29T06:35:46.837 回答
0

检查确认密码最小字符验证,然后你可以使用

<input type="password" id="password" name="password"  class="validate[required,minSize[8]]"/>
<input type="password" id="confirm_password" name="confirm_password"  class="validate[required,equals[password]]"/>
于 2016-08-19T04:54:41.700 回答