Submit Button for Form - Coding to Auto-fill Subject Line
Copy link to clipboard
Copied
Hello,
I have created a form in Acrobat (timecard set-up) that requires coding attached to the Submit button. I have researched extensively through this forum and have found three coding options with fields inserted that work on some technologies:
var customSubject = this.getField("Employee Name").value + " - " + this.getField("Week Ending/Date").value;
var mailtoUrl = "mailto:?subject=BML Weekly Timecard for " + customSubject;
this.submitForm({
cURL: mailtoUrl, cSubmitAs: "PDF" });
var customSubject = this.getField("Employee Name").value + " - " + this.getField("Week Ending/Date").value;
var mailtoUrl = "mailto:?subject=BML Weekly Timecard for " + customSubject;
this.submitForm({
cURL: mailtoUrl, bPDF:true
});
this.mailDoc({cTo: "", cSubject:"BML Weekly Timecard for " + this.getField("Employee Name").valueAsString + " - " + this.getField("Week Ending/Date").valueAsString});
Additionally, here is a screenshot of how the properties are set-up. The challenge is that none of the coding above work on both Apple and Samsung/Android cell phones.
Does anyone have any other coding suggestions?
Here is the overall expectation:
1. Submit button automatically opens default email program and composes new message for Apple and Android cell phones. (Most users are prompted to choose an email program from list of apps.)
2. PDF automatically attaches itself to new email. (No issues)
3. Subject populates by inserting the following content: BML Weekly Timecard for "Employee Name" - "Date" (pulls the name from the employee name and date from the form).
4. Nothing is needed to populate in the To: line or body, just the subject line.
Thank you for taking the time to review my request!
Copy link to clipboard
Copied
1. This is not going to work with a script, maybe only with the Submit a Form command, but then you can't set the subject line or email address dynamically. They have to be hard-coded into the URL.
Copy link to clipboard
Copied
Thank you. How do I hard code into the URL?
Copy link to clipboard
Copied
I'm new to inserting JS into forms; how is my request different than others wanting a custom subject line when submitting a form via email? Please help!
Copy link to clipboard
Copied
Advanced scripting features are only available in compliant PDF viewers, i.e., Acrobat/Reader on the desktop. On the iPad, PDF Expert from Readdle also supports some advanced JavaScript functionalitiy, such as the email submit. But that's about it.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Are you going to force your employees to use a particular PDF viewer on iOS and Android? Which one?
Really, PDF forms are not the best solution for you. HTML forms, submitted to a web server NOT EMAIL are surely more practical, even if less attractive.

