Copy link to clipboard
Copied
Hello everyone, I'm very new to fillable forms and I hope you can help. I've been researching about this for awhile now to no avail. Please help 😅
I have a text field property that's formatted to Date. What I want to do is for the user to be able to choose present and future dates only when they click on it. Is that possible at all and can you share some workaround or there's really no solution for that?
Most grateful for your responses. Thank you.
Copy link to clipboard
Copied
You can try something like this as 'Validate' script of date field:
if(event.value){
var currentDate = new Date();
var enteredDate = util.scand("mm/dd/yyyy", event.value);
currentDate.setHours(0, 0, 0, 0);
enteredDate.setHours(0, 0, 0, 0);
if(enteredDate < currentDate){
app.alert("Please enter a current or future date.");
event.value = "";}}
If the user doesn't enter a current or future date, it will pop alert and clear the field.
Copy link to clipboard
Copied
Hi there
Hope you are doing well and thanks for reaching out.
The workflow you are trying to achieve might be possible using JavaScript. For more information, please check the help pages listed below:
https://acrobatusers.com/tutorials/javascript_console/
https://helpx.adobe.com/acrobat/using/applying-actions-scripts-pdfs.html
Hope it will help
Regards
Amal
Copy link to clipboard
Copied
You can try something like this as 'Validate' script of date field:
if(event.value){
var currentDate = new Date();
var enteredDate = util.scand("mm/dd/yyyy", event.value);
currentDate.setHours(0, 0, 0, 0);
enteredDate.setHours(0, 0, 0, 0);
if(enteredDate < currentDate){
app.alert("Please enter a current or future date.");
event.value = "";}}
If the user doesn't enter a current or future date, it will pop alert and clear the field.
Copy link to clipboard
Copied
OMG THANK YOU! It worked perfectly. I'm so grateful. Thank you so much Nesa!!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now