Copy link to clipboard
Copied
Hello,
I need to set date conditions so that when a student enters a date into the ORIGINAL EXAM DATE field, it is BEFORE today; and when a student enters a date into the PROPOSED EXAM DATE field, it is AFTER today.
Thank you!
Assuming the date fields are formatted as mm/dd/yyyy, enter the following custom validation script into the Original Exam Date field:
if(event.value && util.scand("mm/dd/yyyy", event.value)> new Date())
{
app.alert("Date must be before today.",1)
event.value="";
}
Enter the following custom validation script into the proposed exam date:
if(event.value && util.scand("mm/dd/yyyy", event.value)<= new Date())
{
app.alert("Date must be after today.",1)
event.value="";
}
To reject the entered value it's better to use:
event.rc = false;
Instead of:
event.value="";
The former will revert the field to its previous value, instead of clearing it altogether.
Copy link to clipboard
Copied
Assuming the date fields are formatted as mm/dd/yyyy, enter the following custom validation script into the Original Exam Date field:
if(event.value && util.scand("mm/dd/yyyy", event.value)> new Date())
{
app.alert("Date must be before today.",1)
event.value="";
}
Enter the following custom validation script into the proposed exam date:
if(event.value && util.scand("mm/dd/yyyy", event.value)<= new Date())
{
app.alert("Date must be after today.",1)
event.value="";
}
Copy link to clipboard
Copied
To reject the entered value it's better to use:
event.rc = false;
Instead of:
event.value="";
The former will revert the field to its previous value, instead of clearing it altogether.