jquery validate 前端验证,有时生效,有时不生效,求助!
代码很简单,用jquery对查询起止日期进行判断,如下组合,在我其它页面上验证均无问题,并且在本页面的另外一个表单验证也正常,但是奇怪的是,在这个表单里,执行就是时好时坏,有时候可以出现错误提示,验证正常进行进行,有时候验证直接被跳过去(即不管前端验证成功与否,全部跳到结果界面!!!
这样会导致查询结果为空,已经弄了两天还是没解决,请各位前辈帮忙看看吧,多谢多谢!
引用jquery库:
jquery验证代码:
部分HTML代码如下:
用了 jquery的SimpleModal 框架:
这样会导致查询结果为空,已经弄了两天还是没解决,请各位前辈帮忙看看吧,多谢多谢!引用jquery库:
<script src="jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"></script>
<script src="jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="jquery-ui-1.9.2.custom/development-bundle/ui/jquery.ui.datepicker.js"></script>
<script src="jquery/dist/jquery.validate.js"></script>
<script src="jquery/dist/localization/messages_zh.js"></script>
<script src="jquery/jquery_validate_extended.js"></script>
<script src="jquery/jquery_datapicker_validation/jquery.ui.datepicker.validation.js"></script>
<script src="jquery-ui-1.12.1.custom/jquery.form.js"></script>
<script src="jquery/jquery.simplemodal-1.4.4.js"></script>
jquery验证代码:
$("#frm1").validate({
errorElement:'span',
//debug: true,
rules: {
txt_startdate: {required:true},
txt_enddate: {required:true, compareDate: true},
},
messages: {
txt_startdate: {required: "请选择起始日期!"},
txt_enddate: {required: "请选择结束日期!", compareDate:"起始日期不能大于结束日期!"},
},
errorPlacement: function(error, element) {
alert('aaa');
error.appendTo(element.parent());
},
/* 2019-5-7 如果这一表单无须返回值,这部分应省略掉;如不省略,前端认证会不生效*/
submitHandler: function(form){
//form.submit();
}
});部分HTML代码如下:
用了 jquery的SimpleModal 框架:
<div id='container'>
<form class="FT_form" id="frm1" name="frm1" method="post" action="ftt_ward_results.asp">
<TABLE border=0 cellPadding=0 cellSpacing=0 style="width:100%; overflow:scroll">
<thead>
<tr>
<td id="tdTop" name="tdTop" colspan="3">
<span id="spLog" name="spLog">当前登录用户:<%=request.Cookies("ftt_uid")%></span>
<span id="spRelog" name="spRelog"><a href="ftt_login.asp">重新登录</a></span>
</td>
</tr>
</thead>
<tbody>
<tr>
<td align="center" valign="middle" id="tdNav" name="tdNav" nowrap>
<iframe id="frmNav" name="frmNav" frameborder="0" src="ftt_navLeft.asp"></iframe>
</td>
<td name="tdPoint" id="tdPoint" align="center" valign="middle" onClick="aaa();" nowrap
style="vertical-align:top; padding-top:300px;">
<span class="navPoint" id="switchPoint">3</span>
</td>
<td id="tdMain" valign="top">
<table id="tbl_info">
<tr style="background-color:#0056a5; border:1px solid #666; color:white; font-weight:bold; text-height:30px; height:30px;">
<td colspan="10" style="text-align:left">客房入住情况查询 - 起止日期选择</td>
</tr>
<tr style="text-align:left;">
<td colspan="10" style="text-align:left;">
<label for="lbl1" style="margin-left:5px; margin-right:2px;">从</label>
<input type="text" name="txt_startdate" id="txt_startdate">
<label for="lbl2" style="margin-left:15px; margin-right:2px;">至</label>
<input type="text" name="txt_enddate" id="txt_enddate">
<button class="submit" type="button" name="btn_search" id="btn_search" value="submit"
onClick="form.submit();">查询</button>
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</form>
</div>
...全文
相关推荐
jQuery Validate表单验证实例
实例是用jQuery的validate插件做的登陆表单的验证,效果还不错,代码部分可以参见我写的这篇博客:http://blog.csdn.net/eson_15/article/details/51497533
jquery validate的漂亮css样式验证
NULL 博文链接:https://chenshuai365-163-com.iteye.com/blog/769779
jquery validate 自定义验证方法介绍 日期验证
jquery validate有很多验证规则,但是更多的时候,需要根据特定的情况进行自定义验证规则。 这里就来聊一聊jquery validate的自定义验证。 jquery validate有一个方法,可以让用户来自定义验证规则。 案例一: 代码如下://自定义验证 $.validator.addMethod(“isPositive”,function(value,element){ var score = /^[0-9]*$/; return this.optional(element) || (score.
jQuery Validate表单验证插件
jQuery Validate表单验证插件,前端jq验证,jq验证插件
jQuery validate 验证radio实例
主要介绍了jQuery validate 验证radio实例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下


