form.valid()应该不显示验证文本? [英] form.valid() should not display validation text?
问题描述
使用Jquery.validate required
字段显示对fileds的弹出窗口验证(如下面的图片所示)
With Jquery.validate required
fields are showing popup validation on fileds (like below pic)
我喜欢这个并且工作正常.
I like this and working fine.
但是我检查!form.valid()
条件Popup
消失了,并且显示了正常的验证文本(如下面的图片所示)
But I check !form.valid()
condition Popup
disappearing and normal validation text is displaying (like below pic)
java脚本功能
<script type="text/javascript" >
var form = $("#form1");
$('#<%=imgLogin.ClientID%>').click(function (e) {
if (!form.valid()) {
e.preventDefault();
} else {
<%=Page.ClientScript.GetPostBackEventReference(btnLogin, "")%>
}
});
</script>
仅在检查表单验证时如何返回弹出窗口.
How to get back popup only when checking form validation.
推荐答案
这些弹出窗口与jQuery Validation插件完全无关.这就是HTML5验证属性触发的HTML5验证.通常,jQuery Validate插件会禁用HTML5验证.如果您看到弹出窗口,则意味着您未能正确初始化jQuery Validate插件.
Those popups have absolutely nothing to do with the jQuery Validation plugin. That is HTML5 validation triggered by your HTML5 validation attributes. Normally, HTML5 validation is disabled by the jQuery Validate plugin. If you're seeing popups, it means that you've failed to properly initialize the jQuery Validate plugin.
如果您只想查看HTML5验证弹出窗口(视觉样式和支持取决于浏览器版本),则不能使用jQuery Validate插件.
If you only want to see HTML5 validation popups (visual style and support depends on browser version), then you can not use the jQuery Validate plugin.
或者,如果要在工具提示中显示jQuery Validate的消息,则必须正确集成自己的工具提示组合或诸如Tooltipster或qTip2之类的插件.
Alternatively, if you want to display the messages from jQuery Validate within tooltips, you'll have to properly integrate your own tooltip concoction or a plugin such as Tooltipster or qTip2.
这篇关于form.valid()应该不显示验证文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!