Copy link to clipboard
Copied
Hoping the hivemind can help a brother out.
We have calendar dropdowns on a PDF form.
Higher command want to have the facility to type 'Unknown' into the field controlled by the dropdown calendar (or have 'Unknown' as a default, which is then replaced by a date selection when the dropdown is activated).
Is there a way to do this?
If there is, it's not immediately apparent ...
Many thanks etc
Copy link to clipboard
Copied
Hi Munky.gybbon
Hope you are doing well and sorry for the trouble. As described you want to type 'Unknown' into the field controlled by the dropdown calendar.
It is possible with the help of JavaScript. FOr more information about using JavaScript please check out the help article https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/js_developer_guide.pdf and see if that works
Regards
Amal
Copy link to clipboard
Copied
Thanks for the link, it's probably helpful.
Which section should I be looking at?
Copy link to clipboard
Copied
I'm afraid it's not possible. The calendar widget only appears if the field's Format is set to Date, but that means you can't enter some other arbitrary string (such as "Unknown") into it. So you have to choose one or the other. If you can live without the calendar widget you can still write code to validate the user's input and make sure it's a valid date.
Copy link to clipboard
Copied
Little tip:
- Place the word "unknown" as a static layout text, under the Date field with a Transparent fillColor.
- Use the onFocus action to place a script that will turn the fillColor to white when the field is clicked, so it will hide the word "unknown":
event.target.fillColor = color.white;
- Use a Validation script to revert the fillColor to Transparent if the field is not filled by the user.
if (event.value.toString().length == 0) {event.target.fillColor = color.transparent;}