我要在dataTable中发送两个字段,提交“ PRICE”和“ INSTALLMENT PRICE”(INSPRICE)
在我发送之前,我需要进行验证
editor.on('preSubmit', function (e, o, action) {
if (action !== 'remove') {
if (o.data.PRICE != "" && (o.data.INSPRICE == "0" || o.data.INSPRICE == "")) {
if (parseInt(o.data.PRICE.replace(".", "").replace(",", ".")) < parseInt(o.data.MINPRICE) || parseInt(o.data.PRICE.replace(".", "").replace(",", ".")) > parseInt(o.data.MAXPRICE)) {
swal({
title: "PRICE!",
text: "PRICE IS TOO LOW",
type: "warning"
});
return true;
}
}
if (o.data.INSPRICE!= "0") {
if (parseInt(o.data.INSPRICE.replace(".", "").replace(",", ".")) < parseInt(o.data.MINPRICE) || parseInt(o.data.INSPRICE.replace(".", "").replace(",", ".")) > parseInt(o.data.MAXPRICE)) {
swal({
title: "Preço!",
text: "INSPRICE IS TOO LOW",
type: "warning"
});
return true;
}
}
};
});
我需要分别验证字段
这样,当我发送价格时,我该怎么做?我有对price和insprice的验证
INSPRICE也会发生
答案 0 :(得分:1)
我用这个解决了
//form[contains(@class,'step2')]/div[contains(@class,'row')]/div[contains(@class,'col-xs-12')]/input[contains(@id,'id-')]
我正在使用变量indiceEditor来了解我将更新的时间到的字段