jquery.validate新增重置验证方法,将valid替换为resetValid用户体验会更好

This commit is contained in:
thinkgem
2019-05-15 17:42:01 +08:00
parent a2d9c846bf
commit 1b66126184
7 changed files with 18 additions and 18 deletions

View File

@@ -61,7 +61,7 @@ for (c in child.columnList){
editable:true, edittype:'select', editoptions:{<%if (c.showType == 'select_multiple' || c.showType == 'checkbox'){ %>multiple:true, <% } %>'class':'form-control${cssClass}', editable:true, edittype:'select', editoptions:{<%if (c.showType == 'select_multiple' || c.showType == 'checkbox'){ %>multiple:true, <% } %>'class':'form-control${cssClass}',
items: $.merge([<%if (!(c.showType == 'select_multiple' || c.showType == 'checkbox')){ %>{dictLabel:'&nbsp;',dictValue:''}<% } %>], \${@DictUtils.getDictListJson('${c.optionMap['dictType']}')}), items: $.merge([<%if (!(c.showType == 'select_multiple' || c.showType == 'checkbox')){ %>{dictLabel:'&nbsp;',dictValue:''}<% } %>], \${@DictUtils.getDictListJson('${c.optionMap['dictType']}')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },

View File

@@ -166,9 +166,9 @@ $("#inputForm").validate({
}); });
$('#corpCode_').change(function(){ $('#corpCode_').change(function(){
if ($('#loginCode').val() != ''){ if ($('#loginCode').val() != ''){
$('#loginCode').valid(); $('#loginCode').resetValid();
}else{ }else{
$('#loginCode').val('admin'+$(this).val()).valid(); $('#loginCode').val('admin'+$(this).val()).resetValid();
} }
}); });
//加载角色列表 //加载角色列表

View File

@@ -237,7 +237,7 @@ $("#empOfficeGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{postName:'&nbsp;',postCode:''}], ${toJson(postList)}), items: $.merge([{postName:'&nbsp;',postCode:''}], ${toJson(postList)}),
itemLabel: 'postName', itemValue: 'postCode', dataInit: function(element){ itemLabel: 'postName', itemValue: 'postCode', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },

View File

@@ -134,7 +134,7 @@ $('#dataGrid').dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -142,7 +142,7 @@ $('#dataGrid').dataGrid({
// editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', // editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
// items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), // items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
// itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ // itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
// $(element).select2().on("change",function(){$(this).valid()}); // $(element).select2().on("change",function(){$(this).resetValid()});
// } // }
// } // }
// }, // },

View File

@@ -263,7 +263,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -271,7 +271,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -279,7 +279,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -287,7 +287,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },

View File

@@ -239,7 +239,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -247,7 +247,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -255,7 +255,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -263,7 +263,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },

View File

@@ -212,7 +212,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -220,7 +220,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -228,7 +228,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{'class':'form-control', editable:true, edittype:'select', editoptions:{'class':'form-control',
items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([{dictLabel:'&nbsp;',dictValue:''}], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },
@@ -236,7 +236,7 @@ $("#testDataChildDataGrid").dataGrid({
editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control', editable:true, edittype:'select', editoptions:{multiple:true, 'class':'form-control',
items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}), items: $.merge([], ${@DictUtils.getDictListJson('sys_menu_type')}),
itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){ itemLabel: 'dictLabel', itemValue: 'dictValue', dataInit: function(element){
$(element).select2().on("change",function(){$(this).valid()}); $(element).select2().on("change",function(){$(this).resetValid()});
} }
} }
}, },