• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to set date conditions on PDF?

Community Beginner ,
Jul 23, 2024 Jul 23, 2024

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!

TOPICS
How to , JavaScript , PDF , PDF forms

Views

202

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Jul 23, 2024 Jul 23, 2024

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="";
}

Votes

Translate

Translate
Community Expert , Jul 24, 2024 Jul 24, 2024

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.

Votes

Translate

Translate
Community Expert ,
Jul 23, 2024 Jul 23, 2024

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="";
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 24, 2024 Jul 24, 2024

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines