Authored by ZhongW

优惠折扣修改

... ... @@ -143,9 +143,9 @@
<div class="form-inline">
<div class="form-group" id="resultdiscount">
<input type="text" class="form-control observe" placeholder="0.00"
<input type="text" class="form-control observe" placeholder="优惠结果,格式:0.0"
id="discount"
value="[[discount]]" required pattern="^0(.\d{1,2})?$"
value="[[discount]]" required pattern="^\d(.\d{1,1})?$"
data-field="discount">
,
</div>
... ...
... ... @@ -273,13 +273,13 @@ edit.prototype = {
err.push("<p>" + name + "不可为空</p>");
});
}
if ((id || name) && $(this).attr("match") && $.trim($(this).val())) {
if ((id || name) && $(this).attr("pattern") && $.trim($(this).val())) {
new Validator.init($(this)[0], {
rules: {
match: $(this).attr("match")
match: $(this).attr("pattern")
}
}).validate(function(obj) {
err.push("<p>" + name + "请输入正确的格式</p>");
err.push("<p>" + name.split(",")[0] + "请输入正确的格式</p>");
});
}
... ...
... ... @@ -86,8 +86,10 @@ fn.max = function(param) {
fn.match = function(param) {
var re = this.regExps[param];
if (!re) {
throw new Error(param + ':'
+ Object.keys(this.options.regExps).join(', '));
var regrex=new RegExp(param,'g')
return regrex.test(this.value);
//throw new Error(param + ':'
// + Object.keys(this.options.regExps).join(', '));
}
return this.regExps[param].test(this.value);
};
... ...