Bewusstsein
Bewusstsein

Reputation: 1621

PDF date field - one format, multiple valid inputs

I need to create a PDF with a date field that displays dates in the format dd.mm.yyyy. This field must be validated and should also accept inputs in other formats.

For example, users should be able to input dates in the form dd.mm.yy, which will then be expanded to dd.mm.20yy (MS Office apps like Excel do this).

Alternatively, selecting multiple valid formats would be an acceptable solution.

What currently happens:

The last behaviour is almost what i need, just with the wrong format.

Is there a way to do this without custom Javascript? If not, is there a way to still use the built-in formatting or do i have to rewrite everything in JS?

Upvotes: 0

Views: 584

Answers (1)

jss
jss

Reputation: 151

Unfortunately this is not achievable with Acrobat's built-in formatting.

One thing to add to your second bullet point: it trims the date down to .yy when you exit the field, but it still retains all four digits. When you click into the field, it will revert back to being .yyyy. That may or may not matter depending on how you're using it.

Regarding a custom validation, a quick Google search will yield an abundance of Javascript date validation scripts. Something like this could probably be quickly repurposed for your application.

Upvotes: 1

Related Questions