Date scripts for DD/MM/YYYY

Explorer ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

I currently have this custom validate script.

  1. event.rc = true;

if (event.value) {

var d = util.scand("dd/mm/yyyy", event.value);

if (d==null) {

        app.alert("Please enter a date in dd/mm/yyyy format.");

        event.rc = false;

} else if (d.getFullYear()<1900 || d.getFullYear()>2100) {

        app.alert("Error! Invalid year.");

        event.rc = false;  

}

  }

This works well except it will allow you to put letters 10/nov/2018 and nov/10/2018. I need only numbers and slashes in the field (no letters for month).

What can I add to this script to make this happen?

Format/Date/Custom, does not work with script.

And without script they can enter "01/01/0994"

Format number no decimal, does not work with script either.

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

152

Likes

translate

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 1 Correct Answer

Most Valuable Participant , Dec 06, 2018 Dec 06, 2018
You'll need to write your own custom Format and Keystroke scripts to beable to do it.On Thu, 6 Dec 2018 at 14:48, marilynr59152174 <forums_noreply@adobe.com>

Likes

translate

Translate

Translate
Most Valuable Participant ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

You'll need to write your own custom Format and Keystroke scripts to be

able to do it.

On Thu, 6 Dec 2018 at 14:48, marilynr59152174 <forums_noreply@adobe.com>

Likes

translate

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
Explorer ,
Dec 06, 2018 Dec 06, 2018

Copy link to clipboard

Copied

That sounds like a good solution, unfortunately I am not very good at creating scripts.

Do you think you can help me out with a custom format and keystroke script?

It would be greatly appreciated.

Thank you

Likes

translate

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