Commit 5868c0b1 by naan1993

初始化验证框架,引入bootstrap validator

parent 0c951c57
......@@ -10,6 +10,7 @@
<link href="${ctxPath}/static/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="${ctxPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
<link href="${ctxPath}/static/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="${ctxPath}/static/css/plugins/validate/bootstrapValidator.min.css" rel="stylesheet">
<link href="${ctxPath}/static/css/animate.css" rel="stylesheet">
<link href="${ctxPath}/static/css/style.css?v=4.1.0" rel="stylesheet">
<link href="${ctxPath}/static/css/_fstyle.css" rel="stylesheet">
......@@ -24,6 +25,8 @@
<script src="${ctxPath}/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctxPath}/static/js/plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="${ctxPath}/static/js/plugins/validate/bootstrapValidator.min.js"></script>
<script src="${ctxPath}/static/js/plugins/validate/zh_CN.js"></script>
<script src="${ctxPath}/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
<script src="${ctxPath}/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="${ctxPath}/static/js/plugins/jquery-treegrid/js/jquery.treegrid.min.js"></script>
......
......@@ -11,7 +11,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">${name}</label>
<div class="col-sm-9">
<input class="form-control" id="${id}"
<input class="form-control" id="${id}" name="${id}"
@if(isNotEmpty(value)){
value="${tool.dateType(value)}"
@}
......
/*!
* BootstrapValidator (http://bootstrapvalidator.com)
* The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
*
* @version v0.5.3, built on 2014-11-05 9:14:18 PM
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2014 Nguyen Huu Phuoc
* @license Commercial: http://bootstrapvalidator.com/license/
* Non-commercial: http://creativecommons.org/licenses/by-nc-nd/3.0/
*/
.bv-form .help-block{margin-bottom:0}.bv-form .tooltip-inner{text-align:left}.nav-tabs li.bv-tab-success>a{color:#3c763d}.nav-tabs li.bv-tab-error>a{color:#a94442}.bv-form .bv-icon-no-label{top:0}.bv-form .bv-icon-input-group{top:0;z-index:100}
\ No newline at end of file
......@@ -125,5 +125,17 @@ var Feng = {
}
}
});
},
initValidator: function(formId,fields){
$('#' + formId).bootstrapValidator({
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: fields,
live: 'enabled',
message: '该字段不能为空'
});
}
};
This source diff could not be displayed because it is too large. You can view the blob instead.
/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
* http://jqueryvalidation.org/
* Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
! function (a) {
"function" == typeof define && define.amd ? define(["jquery", "jquery.validate.min"], a) : a(jQuery)
}(function (a) {
var icon = "<i class='fa fa-times-circle'></i> ";
a.extend(a.validator.messages, {
required: icon + "必填",
remote: icon + "请修正此栏位",
email: icon + "请输入有效的电子邮件",
url: icon + "请输入有效的网址",
date: icon + "请输入有效的日期",
dateISO: icon + "请输入有效的日期 (YYYY-MM-DD)",
number: icon + "请输入正确的数字",
digits: icon + "只能输入数字",
creditcard: icon + "请输入有效的信用卡号码",
equalTo: icon + "你的输入不相同",
extension: icon + "请输入有效的后缀",
maxlength: a.validator.format(icon + "最多 {0} 个字"),
minlength: a.validator.format(icon + "最少 {0} 个字"),
rangelength: a.validator.format(icon + "请输入长度为 {0} 至 {1} 之间的字串"),
range: a.validator.format(icon + "请输入 {0} 至 {1} 之间的数值"),
max: a.validator.format(icon + "请输入不大于 {0} 的数值"),
min: a.validator.format(icon + "请输入不小于 {0} 的数值")
})
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment