刚开始使用 jquery validate,我收到多个无效字段的错误。我移动了错误容器,我可以看到在更正字段后所有错误仍然存在。我最终得到了一堆堆叠在一起的错误。我想查看“当前”错误。
你可以在这里看到我的意思:http: //opiemedia.com/dev/lo/sv/varB/
这就是我使用表单验证的内容
$(document).ready(function() {
$("#evalFrm").validate({
rules: {
name: {
required: true,
minlength: 2,
},
company: {
minlength: 2,
},
email: {
required: true,
email: true,
},
phone: {
required:true,
minlength: 7,
}
},
errorLabelContainer: "#evalErr",
errorClass: "error label label-warning"
});
});
这是 HTML
<div class="span8 well" style="margin-left:0;">
<form id="evalFrm action="#" method="post" class="evalFrm" name="evalFrm">
<input name="oid" type="hidden" value="00D400000008j4N" />
<input name="retURL" type="hidden" value="#" />
<input class="span6" id="name" name="name" placeholder="Full Name" type="text" />
<input class="span6" id="company" name="company" placeholder="Company" type="text" />
<input class="span6" id="email" name="email" placeholder="Email" type="email" />
<input class="span6" id="phone" name="phone" placeholder="Phone" type="tel" />
<button class="btn btn-success span6 offset3" type="submit"onclick="_kmq.push(['record', 'Request Info Form Submission']);">Evaluate </button>
</form>
<div id="evalErr"></div>
</div>
感谢您花时间帮助我!