Code for sending email in Adobe Acrobat doesn't work. Where does it go wrong?

Debugging

Using Adobe Acrobat Pro I am filling out a form that will be used by a variety of people, and I require each form to be sent to a different email address (that the user specifies) when the form is complete.

Does anyone know what javascript I need to write to accomplish this?

I tried the Submit form function of the adobe acrobat button, but it doesn't allow me to customize the Mailto: form.

I found the following code, which works to send an email with the subject line changing according to what users have written in an earlier text field.

var customSubject = this.getField("MyTextField").value;
var mailtoUrl = "mailto:studiosupport@qoppa.com?subject=" + customSubject;
this.submitForm({
cURL: mailtoUrl, bPDF:true
});

I know next to nothing about Javascript, but I attempted to rewrite it so that the user response in "MyTextField" would be influencing who the email would go to instead. My code doesn't work, however.

var customEmail = this.getField("MyTextField").value;
var Subject = Return Form;
var mailtoUrl = "customEmail?subject=";
this.submitForm({
cURL: mailtoUrl, bPDF:true
});

The error message reads JavaScript error at line 3: SyntaxError: missing ; before statement 2

What am I doing wrong?

Edit: I've updated it to this

var CE= this.getField("MyTextField").value;
var customEmail = "mailto:CE";
var mailtoUrl = customEmail+?"subject"=;
this.submitForm({
 cURL: mailtoUrl, bPDF:true
});

and the error has updated too! Woot! It now says

JavaScript error at line 4: SyntaxError: syntax error

3

Posted Nov 4, 2022, 1:34 AM UTC · edited

214
Loading comments…