Skip to main content
Inspiring
December 6, 2018
Answered

Date scripts for DD/MM/YYYY

  • December 6, 2018
  • 1 reply
  • 630 views

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 has been closed for replies.
Correct answer try67

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>

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 6, 2018

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>

Inspiring
December 6, 2018

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