I made up an editable PDF for students to request transcripts. Now, I want to constrain the input. For example, I want only numbers for their ID number, and I want only letters (no special characters) in the name fields, etc. In addition, there's an input called "Year Last Attended" where they enter the last academic year the user attended the university. If the value entered is within 5 years of the current date, then the user should alerted that he/she can request a transcript through another website.
Can JS do this? If so, how would you do this? I just need examples for the things I've listed above, and I can work from there. If not, how would I do this in a PDF (Acrobat Pro)?
Anyone have suggestions for tutorials in Javascript specifically for PDF?
Yes, the Adobe Acrobat Reader supports hosting JavaScript for uses such as field validation.
Here's some reference material:
http://www.adobe.com/devnet/acrobat/javascript.html
and some tutorials:
http://www.evermap.com/javascript.asp
AFAIK, you will need the full (Pro) version of Acrobat to write the scripts.
来源:https://stackoverflow.com/questions/1733358/javascript-in-a-pdf