Skip to main content
Inspiring
Dec 6, 2018 1:48 PM UTC
Answered

Date scripts for DD/MM/YYYY

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.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 6, 2018 1:59 PM UTC

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>

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 6, 2018 1:59 PM UTC

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>

Translate
Inspiring
Dec 6, 2018 2:18 PM UTC

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

Translate