Bootstrap验证
<div class="modal fade" id="myModal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<form id="addBookCode">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h1 class="modal-title" id="myModalLabel"><span>场景信息配置</span></h1>
</div>
<div class="modal-body">
<div class="form-group col-xs-12">
<div class="col-xs-4 text-right">
<label class="label_contorl text-right" for="txt_SenarioName_">情景名称:</label>
</div>
<div class="col-xs-7">
<input name="txt_SenarioName_" id="txt_SenarioName_" class="form-control" value="" />
</div>
<label class="label_contorl text-left message">*</label>
</div>
<div class="form-group col-xs-12">
<div class="col-xs-4 text-right">
<label class="label_contorl text-right" for="txt_YieldRateCurve_">收益率曲线:</label>
</div>
<div class="col-xs-7">
<asp:DropDownList ID="txt_YieldRateCurve_" name="txt_YieldRateCurve_" runat="server" CssClass="form-control datacontrol drop_combo"></asp:DropDownList>
</div>
<label class="label_contorl text-left message">*</label>
</div>
<div class="form-group col-xs-12">
<div class="col-xs-4 text-right">
<label class="label_contorl text-right" for="txt_SearchCloseDate_">曲线日期:</label>
</div>
<div class="col-xs-7">
<asp:DropDownList ID="txt_SearchCloseDate_" name="txt_SearchCloseDate_" onclick="WdatePicker()" Format="{0:yyyy-MM-dd}" runat="server" CssClass="form-control datacontrol drop_combo"></asp:DropDownList>
</div>
<label class="label_contorl text-left message">*</label>
</div>
<div class="form-group col-xs-12">
<div class="col-xs-4 text-right">
<label class="label_contorl text-right" for="txt_Currency_">货币:</label>
</div>
<div class="col-xs-7">
<asp:DropDownList ID="txt_Currency_" name="txt_Currency_" runat="server" CssClass=" datacontrol form-control"></asp:DropDownList>
</div>
<label class="label_contorl text-left message">*</label>
</div>
<div class="form-group col-xs-12">
<div class="col-xs-4 text-right">
<label class="label_contorl text-right" for="txt_EndUser_">使用单位:</label>
</div>
<div class="col-xs-7">
<asp:DropDownList ID="txt_EndUser_" name="txt_EndUser_" runat="server" CssClass=" datacontrol form-control"></asp:DropDownList>
</div>
<label class="label_contorl text-left message">*</label>
</div>
<div class="clearfix"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary btn-sm" id="btn_save1">确认</button>
<button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
</div>
</div>
</form>
</div>
</div>
//添加新增验证规则
$('#myModal').bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
txt_SenarioName_: {
validators: {
notEmpty: {
message: '不能为空'
}
}
},
txt_YieldRateCurve_: {
validators: {
notEmpty: {
message: '不能为空'
}
}
},
txt_SearchCloseDate_: {
validators: {
notEmpty: {
message: '不能为空'
}
}
},
txt_Currency_: {
validators: {
notEmpty: {
message: '不能为空'
}
}
},
txt_EndUser_: {
validators: {
notEmpty: {
message: '不能为空'
}
}
}
}
}); $('#myModal').on('hide.bs.modal', function (e) {
$("#myModal").data('bootstrapValidator').resetForm()
}) function ModelValidate() { var bootstrapValidator = $("#myModal").data('bootstrapValidator');
//手动触发验证
$("#myModal").data('bootstrapValidator').validate()
if (bootstrapValidator.isValid()) {
console.log("tj")
//表单提交的方法、比如ajax提交
$('#myModal').modal('hide') }
else {
return false;
}
}
Bootstrap验证的更多相关文章
- Bootstrap验证控件的使用
前端HTML代码 <form id="myForm" method="post" class="form-horizontal" ac ...
- bootstrap validate 验证插件
1.需要引入bootstrapValidator.min.js 2.在需要验证的控件中添加 class="form-control" 3.js中写验证的方法 $('#psasave ...
- ASP.NET MVC使用Bootstrap系统(2)——使用Bootstrap CSS和HTML元素
阅读目录 Bootstrap 栅格(Grid)系统 Bootstrap HTML元素 Bootstrap 验证样式 ASP.NET MVC创建包含Bootstrap样式编辑模板 小结 Bootstra ...
- BootStrap-validator 使用记录(JAVA SpringMVC实现)
BootStrap 是一个强大的前面框架,它用优雅的方式解决了网页问题.最近正在使用其开发网站的表单验证,一点体会记录如下: 注:本文中借鉴了博客Franson 的文章<使用bootstrapv ...
- bootstrapvalidator API 文档地址: http://bootstrapvalidator.votintsev.ru/api/
bootstrap验证插件 bootstrapvalidator 文档API 地址 (原始作者英文):http://bootstrapvalidator.votintsev.ru/api/ 具体使用( ...
- Docker多机网络
前言 前面的文章主要聚焦于单机网络上,对于生产环境而言,单机环境不满足高可用的特点,所以是不具备上生产的条件,因此在开始Docker Swarm篇的时候我们先来聊聊多机网络之间Docker的通信如何做 ...
- bootstrap validate 实现页面动态验证(formvalidate)
关于基本的bootstrap validate 验证方法外面有许多博客上都有讲解,我就不在过多叙述了.大家也可以去看官网api:http://bv.doc.javake.cn/api/ 今天要说的是动 ...
- Bootstrap表单验证插件bootstrapValidator使用方法整理
插件介绍 先上一个图: 下载地址:https://github.com/nghuuphuoc/bootstrapvalidator 使用方法:http://www.cnblogs.com/huangc ...
- MVC遇上bootstrap后的ajax表单模型验证
MVC遇上bootstrap后的ajax表单验证 使用bootstrap后他由他自带的样式has-error,想要使用它就会比较麻烦,往常使用jqueyr.validate的话只有使用他自己的样式了, ...
随机推荐
- vb shell函数在c#的转换
vb shell: Private Sub AddBarcodeImages(ByVal DTab As DataTable) If Not DTab Is Nothing Then DTab.Col ...
- pycharm最新版新建工程没导入本地包问题:module 'selenium.webdriver' has no attribute 'Firefox'
前言 最新版的pycharm做了很大的改变,新建工程的时候,默认不导入本地的安装包,这就导致很多小伙伴踩坑了... 明明已经pip安装过selenium了,但是却报AttributeError:mod ...
- python super()函数详解
引言: 在类的多继承使用场景中,重写父类的方法时,可能会考虑到需要重新调用父类的方法,所以super()函数就是比较使用也很必要的解决方法: 文章来源: http://www.cnblogs.com/ ...
- leetcode100
/** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...
- 1.Redis的应用场景
转自:http://www.runoob.com/redis/redis-tutorial.html Redis开创了一种新的数据存储思路,使用Redis,我们不用在面对功能单调的数据库时,把精力放在 ...
- Django中使用Celery实现定时任务(用djcelery)
一.引言 Django是python语言下的一个比较热门的Web框架,越来越多的企业和开发者使用Django实现自己的Web服务器.在Web服务器开发过程中,有时候我们不仅仅是要实现Web服务器端和用 ...
- myeclipse 代码提示
from http://fuyiyuan2011.iteye.com/blog/1258264 在软件开发过程中,有了代码提示能使开发能够更加快捷与便利.但在Eclipse ,MyEclipse等ja ...
- 16 MySQL--正确使用索引
count 统计 count(*)和count(字段名) 基本结果是一样的 但是一种情况例外,就是当某字段名下边的数据有null值的时候,不计入这个count中,*则全部列入count中 一 .索引未 ...
- tensorflow Process finished with exit code 137 (interrupted by signal 9: SIGKILL) 错误
Process finished with exit code 137 (interrupted by signal 9: SIGKILL) 在使用tensorflow自带的数据集做手写数字识别的时候 ...
- spring coud feign
1. 依赖 <parent> <groupId>org.springframework.boot</groupId> <artifactId>sprin ...