0
votes

In short: I want to use Acrobat DC's built-in date picker on a text field without using Acrobat's Format option.

In full:
I'm trying to enable the date fields in my form to accept a large variety of date formats as input, including a date picker. I've written validation code to accomplish this, however Acrobat is rejecting inputs before the validation code triggers and rewrites the date into an acceptable format. This means that I have to set the field's format to "None" in order for my validation code to fire properly, losing the built-in date picker in the process. While this doesn't make the form not work, it hampers UX, which is something I've been working to strongly improve in this form.

To illustrate the issues:
Ideal/Goal:

  • Input "May 25, 2017" into Date Field
  • Validation code converts this to "2017 05 25"
  • Acrobat formatting applies (expects: "yyyy mm dd"), enabling the date picker
  • Acrobat Date Picker is available for more rapid input changes

Current Problem:

  • Input "May 25, 2017" into Date Field
  • Acrobat formatting applies (expects: "yyyy mm dd"), rejects inputs
  • Validation code has nothing to work with
  • Acrobat Date Picker is available for more rapid input changes

Current non-ideal solution:

  • Input "May 25, 2017" into Date Field
  • Validation code converts this to "2017 05 25"
  • Acrobat formatting disabled
  • No Acrobat Date Picker

I see three possible solutions, but don't know enough on how to (or if I can) achieve them.

  1. Preempt Adobe's built in formatting script somehow. I've tried calling event.change and event.willCommit, but I clearly don't understand them enough to use them properly. Additionally, I thought script precedence was Keystroke > Validation > Format > Calculation, but it appears either I'm wrong or Adobe's built in formats are special.
  2. Force enable the date picker somehow. I don't have high hopes for this. I don't get why Adobe didn't make the damn thing a check box option.
  3. Set the Format option to a wildcard somehow. Like the last three, I don't know if this is possible, but this seems the most likely to work. Basically, let the format accept anything.
2
Maybe removing all the eventhandlers is an option.Jeroen Heier

2 Answers

0
votes

You'll need to use two fields. The first one is the main field and uses a custom format script to format your date, not one of the predefined ones. Right beside it is a field formatted for a date that's just wide enough to give you the picker, set it's text color to white so that none of the characters in the value actually show. Use the OnBlur action to update the first field when the user exits the second. If you put them right up against each other, to the end user, they'll appear to be the same field.

0
votes

In addition to @joelgeraci 's answer, you might also consider a non-Adobe date picker (which requires the very newest versions of Acrobat/Reader anyways). There are a few out there, some better some a bit less…

Shameless plug: yours truly happens to have created the most elaborate and configurable date picker for PDF forms; for more information and quotes, feel free to contact me in private.