注册表验证无效

时间:2018-12-05 08:18:01

标签: forms bootstrap-4

注册表单未经脚本验证。这是表单输入名称电子邮件和密码,它只是提交未经验证的页面。我需要帮助来验证下面的表单,表单只是通过验证提交。我在控制台中没有看到任何错误消息。

   `<form id="reg_form" class="form" role="form" autocomplete="off">
<div class="form-group">
    <label for="inputName">Name</label>
    <input type="text" class="form-control" id="inputName" placeholder="Full name">
</div>
<div class="form-group">
    <label for="inputEmail3">Email</label>
    <input type="email" class="form-control" id="inputEmail3" placeholder="Email" required="">
</div>
<div class="form-group">
    <label for="inputPassword3">Password</label>
    <input type="password" class="form-control" id="inputPassword3" placeholder="Password" required="">
</div>
<div class="form-group">
    <label for="inputVerify3">Verify</label>
    <input type="password" class="form-control" id="inputVerify3" placeholder="Password (again)" required="">
</div>
<div class="form-group">
    <button type="submit" class="btn btn-success btn-lg float-right">Register</button>
</div>
</form>`

      http://cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/js/bootstrapvalidator.min.js

   `$(document).ready(function() {
    $("#reg_form").bootstrapValidator({
    fields: {
        inputName: {
            validators: {
                    stringLength: {
                    min: 2,
                },
                    notEmpty: {
                    message: 'Please enter your first name'
                }
            }
        },
         inputEmail3: {
            validators: {
                notEmpty: {
                    message: 'Please supply your email address'
                },
                emailAddress: {
                    message: 'Please supply a valid email address'
                }
            }
        },
        inputPassword3: {
            validators: {
                identical: {
                    field: 'inputVerify3',
                    message: 'Confirm your password below - type same password please'
                }   
            }
        },
    }
    });
  });`

0 个答案:

没有答案