Date Comparison Script
I have multiple date fields, ie:
Date.0
Date.1
…
Date.5
Date.6
These are formatted mm/dd/yyyy
In the custom validation script, after Date.0, I use the following to get the current number of the date field:
var str = event.target.name;
var res = str.charAt(str.length-1);
I then use this.getField("0." + (res-1)).value to compare against event.value.
What want to do is:
- Compare the two dates to determine if the date just entered pre-dates the preceding date.
- And, if it does, serve up: app.alert("The date you entered is invalid. Please enter a date that does not pre-date the previous entry date." ,0);
I would very much appreciate help in getting a working script.
Thank you
