【发布时间】:2017-11-09 06:47:09
【问题描述】:
似乎无法让它工作。尝试做一个确认电子邮件引导验证器。原始电子邮件验证器有效,但第二个无效。不知道我错过了什么。
<div class="form-group">
<div class="col-md-11">
<label for="inputEmail" class="sr-only">Enter Email</label>
<input type="email" class="form-control" placeholder="Enter Email" id="email" name="email" size="35" required/>
<div class="help-block with-errors"></div>
<span class="glyphicon form-control-feedback" id="email1"></span>
</div>
</div>
<div class="form-group">
<div class="col-md-11">
<input type="email" class="form-control" name="emailConfirmed" placeholder="Confirm Email" id="emailConfirmed" size="35" />
</div>
</div>
$('#form').validate({
fields: {
email: {
minlength: 3,
required: true,
validators: {
notEmpty: {
message: 'The confirm email is required and cannot be empty'
},
identical: {
field: 'emailConfirmed',
message: 'The email and its confirm are not the same'
}
}
},
emailConfirmed: {
validators: {
notEmpty: {
message: 'The confirm email is required and cannot be empty'
},
identical: {
field: 'email',
message: 'The email and its confirm are not the same'
}
}
}
}
});
【问题讨论】:
-
您使用什么库进行验证?