Limit fillable date

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

alpinemultiview
User
Posts: 3
Joined: Mon Feb 27, 2023 10:55 am

Limit fillable date

Post by alpinemultiview »

Hello,

I've searched and not being able to find an answer. I have V9.5 Editor plus edition.

I am creating a PDF form for applicants to fill. I want a start date and an end date to be filled by the applicant.

However, I want the end date to be no later than 2023-10-30. That is, I don't want applicants to be able to put in a later date in that field.

Is this doable?

Regards,

Alpine
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Limit fillable date

Post by Stefan - PDF-XChange »

Hello alpinemultiview,

You can not really limit the calendar that we show in the drop down, but you can do a validation of the date entered once it has been selected. That would require a custom JS validation and if the validation fails - you can e.g. display a different field with a warning message.
Please take a look at the sample attached.

This code:

Code: Select all

var d = this.getField("Date");
var msg = this.getField("WarningMessage");
if (Date.parse(d.value) >= 1701388800000 ){
  msg.display = 0;
}
else {
  msg.display = 1;
}

is placed in the "Value Calculation" entry in the Properties for the Date field form the sample PDF:
image.png
The value of 1701388800000 is the number of milliseconds from 1 Jan 1970 to 1 Dec 2023.

Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.