0
votes

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:

  • If the date format of the field is set to dd.mm.yyyy, dd.mm.yy is rejected.
  • If the date format of the field is set to dd.mm.yy, dd.mm.yyyy is accepted (but formatted to dd.mm.yy).

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?

1

1 Answers

1
votes

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.