我提供以下代码进行审查:
//THIS VALIDATES THE DATE ENTERED
var cMsg = "The date you entered is invalid.\n\nPlease enter a date that does not pre-date the previous entry date.";
var nIcon = 0;
var nType = 0;
var cTitle = "DATE ERROR";
var str = event.target.name;
var res = str.charAt(str.length-1);
var d1 = Date.parse(this.getField("0." + (res-1)).value);
var d2 = Date.parse(event.value);
if(d1 != null) {
if (d1 > d2) {
app.beep();
app.alert(cMsg, nIcon, nType, cTitle);
event.value = "";
}
} else {
var cMsg = "This is an invalid entry\n\nThe previous date entry cannot be empty.\n\nPlease use the entry above first.";
app.beep();
app.alert(cMsg, nIcon, nType, cTitle);
}
规则:
也许我们不是在禁止输入(严格执行),而是警告用户并确认他们希望继续,即使违反了预期的规则……可能会更好。
这对我来说很难。如果可以,请协助。