...
|
...
|
@@ -208,7 +208,6 @@ edit.prototype={ |
|
|
|
|
|
$("input:text",that.el)
|
|
|
.add("input[type=number]",that.el)
|
|
|
|
|
|
.add("input:hidden",that.el)
|
|
|
.add("textarea",that.el)
|
|
|
.each(function() {
|
...
|
...
|
@@ -220,7 +219,7 @@ edit.prototype={ |
|
|
var name=$(this).attr("placeholder")&&!(/^\d+$/.test($(this).attr("placeholder")))?$(this).attr("placeholder").replace(/请填写/g,''):$(this).parents(".form-group").find("label").text().replace(/\*/g,'');
|
|
|
// var rule = [];
|
|
|
|
|
|
if ($(this).attr("required")) {
|
|
|
if (id&&$(this).attr("required")) {
|
|
|
new Validator.init(document.getElementById(id),{
|
|
|
rules:{required:true}
|
|
|
}).validate(function(obj){
|
...
|
...
|
@@ -246,14 +245,25 @@ edit.prototype={ |
|
|
|
|
|
});
|
|
|
|
|
|
//文件上传
|
|
|
$("input[type=file]",that.el).each(function(){
|
|
|
var id = $(this).attr("id");
|
|
|
var value =$.trim($(this).attr("value"));
|
|
|
var name=$(this).attr("placeholder")&&!(/^\d+$/.test($(this).attr("placeholder")))?$(this).attr("placeholder").replace(/请填写/g,''):$(this).parents(".form-group").find("label").text().replace(/\*/g,'');
|
|
|
if ($(this).attr("required")&&!value) {
|
|
|
if (id&&$(this).attr("required")&&!value) {
|
|
|
err.push("<p>"+name+"不可为空</p>");
|
|
|
}
|
|
|
});
|
|
|
//下拉选择
|
|
|
$("select",that.el).each(function(){
|
|
|
var id = $(this).attr("id");
|
|
|
var value =$.trim($(this).val());
|
|
|
var name=$(this).attr("placeholder")&&!(/^\d+$/.test($(this).attr("placeholder")))?$(this).attr("placeholder").replace(/请填写/g,''):$(this).parents(".form-group").find("label").text().replace(/\*/g,'');
|
|
|
|
|
|
if (id&&$(this).attr("required")&&+value==-1) {
|
|
|
err.push("<p>请选择 "+name+"</p>");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// var v = Validator.make(data, rules);
|
|
|
// v.mergeAttribute(attributes);
|
...
|
...
|
|