Copy link to clipboard
Copied
I'm hoping someone here is able to offer me a solution, if one even exists.
I am creating on online form, and I'd like to find a way to automate the population of a particular field on the form.
I am hoping it's possible, with some support from the pros here, that on a click of a field (time) that the field can automatically be cpopulated with the current time. COnsider also, that this form will be filled out on a mobile device, so perhaps a tap would be the same as a click in the field?
Copy link to clipboard
Copied
This should work on mobile Acrobat reader, use as 'On Focus':
event.target.value = util.printd("HH:MM", new Date())
Copy link to clipboard
Copied
To populate the second field (let's call it "time2") add this to the script:
this.getField("time2").value = event.target.value;
But I'm not sure if setting a field to read only can be done on mobile.
Copy link to clipboard
Copied
It depends from browser to browser but you my have trouble using JavaScript, especially on mobile where it's not even supported much.
Copy link to clipboard
Copied
Unfortunately no. The problem is that there are a large number of PDF viewers, and very few of them support the necessary PDF JavaScript. To do this you need to have a way to control where the user opens the PDF.
Copy link to clipboard
Copied
Thank you all.
The users, on mobile, would most certainly be expected to use Adobe Reader (the mobile version). It is the only PDF reader permitted and installed on their devices. Does this help?
I will be posting more "can I" type questions as I pursue the appropriateness of using Adobe forms for my needs. If I get too many "not possibles", I will have to go down a road of deeper unknowns lol.
Copy link to clipboard
Copied
Yes, that helps a lot. I am not totally certain, but the Adobe Mobile Reader should work. However I would not count on this working on a browser PDF viewer.
Copy link to clipboard
Copied
This should work on mobile Acrobat reader, use as 'On Focus':
event.target.value = util.printd("HH:MM", new Date())
Copy link to clipboard
Copied
Thank you both Thom and Nesa. Nesa, thank you for providing the solution. Javascript is not code I'm familiar with unfortunately so the guidance (dare I say hand holding) is greatly appreciated.
If I can expand on this ,,,
After the field has been populated, how can I make that field read only?
and ..
How can I autopopulate a second form field with that same value?
Copy link to clipboard
Copied
To populate the second field (let's call it "time2") add this to the script:
this.getField("time2").value = event.target.value;
But I'm not sure if setting a field to read only can be done on mobile.
Copy link to clipboard
Copied
Thank you Nesa.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now