Validate Required Fields, Email PDF, and Reset Fields on Submit
Hi, friends! I'm new to Acrobat and JS, and have searched the community but can't find quite the answer I'm looking for or can't get the scripts to work together.
I have a simple form with 7 required fields (5 drop-downs, 2 free text if it matters). Currently, I have the Submit button coded to validate the required fields and, if complete, send an email. Script below. The problem is, if the required fields aren't complete, the Submit button does nothing and there's no error message or other indicator of what's missing.
When the Submit button is clicked, I need the following things to happen:
- Validate required fields and generate an error message if any are blank/left on default
- Flatten PDF/make all fields read-only (but data in fields must be copyable)
- Generate an email to the target email address with the flattened PDF attached (currently working)
- Clear all fields on the PDF
Is all this possible? Any help/sample scripting (please make text I would replace super obvious 🙂 ) appreciated!
TIA!


