我在网格文本框中验证了日期范围,如果javascript验证日期范围很好,我可以点击添加按钮并在网格中添加新行。
但是当验证失败时,我需要更正日期范围,在更正之后javacript会完全验证成功,但是当我点击添加按钮时,此按钮控件似乎已禁用。
我们能为此做些什么?
示例代码:
case "dateRange":
var classGroup = "[" + options.validateAttribute + "*=" + rules[i + 1] + "]";
var rowCount = $('table.datagrid tr').length - 1;
var firstOfGroup = form.find(classGroup).eq(rowCount - 2);
var secondOfGroup = form.find(classGroup).eq(rowCount - 1);
if (rowCount > 1) {
//if one entry out of the pair has value then proceed to run through validation
if (firstOfGroup[0].value || secondOfGroup[0].value) {
errorMsg = methods._dateRange(firstOfGroup, secondOfGroup, rules, i, options);
}
if (errorMsg) required = true;
options.showArrow = false;
}
break;