简体   繁体   English

jQuery表单验证器密码错误

[英]jQuery Form Validator Password error

i am validating my form with http://formvalidator.net/ and getting one error. 我正在使用http://formvalidator.net/验证我的表单,并收到一个错误。 I have a three fields for changing the password. 我有三个用于更改密码的字段。

  1. Old Password 旧密码
  2. New Password 新密码
  3. Cofirm Password 确认密码

When user enter their old, new and cofirm password then validator showing me the below error you can see the picture below. 当用户输入旧密码,新密码和确认密码时,验证程序将向我显示以下错误,您可以看到下图。 I don't know why this error occur. 我不知道为什么会发生此错误。 I guess its matching the very first password field how to get rid off this issue? 我猜想它匹配的第一个密码字段如何摆脱这个问题?

Here you can see the error 在这里你可以看到错误

在此处输入图片说明

My Code 我的密码

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.1.27/jquery.form-validator.min.js"></script>

<script>    
    $.validate({
    modules : 'security'
});
</script>

<form name="form2" id="form2" method="post" action="" enctype="multipart/form-data">

        <p>
          <label>Password</label>
          <input type="password" placeholder="Password" name="pass_confirmation" data-validation="custom" data-validation-regexp="^(?=.*\d)[0-9a-zA-Z]{6,}$" data-validation-error-msg="" data-validation-optional="true">
        </p>

        <p>
          <label>New Password</label>
          <input type="password" placeholder="New Password" name="new_pass_confirmation" data-validation="custom" data-validation-regexp="^(?=.*\d)[0-9a-zA-Z]{6,}$" data-validation-error-msg="" data-validation-optional="true">
        </p>

        <p> Repeat password
          <input type="password" placeholder="Confirm Password" name="pass" data-validation="confirmation" data-validation-optional="true">
        </p>       

        <p>
            <input type="submit" name="submit_edit_two"  value="Update" />
        </p>

      </form>

One file i've located in js folder for calling security module, thats security.js. 我在js文件夹中找到一个文件用于调用安全模块,即security.js。 Without this file security validator can't be work. 没有此文件,安全验证程序将无法工作。 You can download security module js file from here . 您可以从此处下载安全模块js文件。

Thanks. 谢谢。

您应该将new_pass_confirmation的名称更改为pass_confirmation,这将解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM