Submit Button for Form - Coding to Auto-fill Subject Line

New Here ,
Mar 05, 2021 Mar 05, 2021

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});

 

Jodi0D44_0-1614946502520.png

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!

TOPICS
Create PDFs, Edit and convert PDFs, JavaScript, PDF forms

Views

94

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 05, 2021 Mar 05, 2021

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2021 Mar 12, 2021

Copy link to clipboard

Copied

Thank you. How do I hard code into the URL?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2021 Mar 16, 2021

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!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 17, 2021 Mar 17, 2021

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. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines