Copy link to clipboard
Copied
submit button with drop down list. Select recieptent from list and then hit submit. How can I create a subject line?
Here is the code we are using (below) but it creates a subject line like this? A91h4gylz_15b7xpu_ca0.fdf
var email = this.getField("Email To:").value;var cSubLine = "Meeting Request Form";
this.mailForm(false, email);
Copy link to clipboard
Copied
You're not doing anything to set the subject of the email at all. Just setting a variable called cSubLine, which you then do nothing with. I suspect you are trying to adapt a sample you have not studied closely enough, and have removed the parts which made it work.
Copy link to clipboard
Copied
I apoligize here is the code from the form properties
var email = this.getField("Email To:").value;
this.mailForm(false, email);
How can I create one with a subject line? If it was just a submit button I could, but it's pulling the email from a drop down list.
Copy link to clipboard
Copied
As mentioned, you did not use the cSubLine variable at all.
Change this line:
this.mailForm(false, email);
To this:
this.mailForm({bUI: false, cTo: email, cSubject: cSubLine});
Note, however, that setting bUI as false will not work if you use this command from a button field. You must run it from a privileged context (such as a folder-level trusted function) to be able to submit the form data silently in this way.
Copy link to clipboard
Copied
I tried that and it is a "PDF" submit button and it would not work.... I have a list to pick the email and then click submit and would like to create a subject line. It currently creates a weired subject line "A919xyn6u_5d0mwq_8zw.fdf" .
Copy link to clipboard
Copied
Please explain exactly what you mean by " it is a "PDF" submit button and it would not work". It's supposed to submit a PDF, that's what it's for. What messages do you get? What does it say in the JavaScript Console?
Copy link to clipboard
Copied
I created a PDF fill-in form and once it's completed there is a dropdown menu where you can select who it gets emailed to and then you click the submit button. I wished it had a subject line but this is the code in the button actions. ( Mouse Up, Run a JavaScript)
var email = this.getField("Email To:").value;
this.mailForm(false, email);
I have checked all my adobe books a cannot find a solution to have it add the subject line.
Copy link to clipboard
Copied
But that's just what you originally had. You said "I tried that and it is a "PDF" submit button and it would not work."
I assumed you meant you tried the different code that someone wrote for you to try, which SPECIFICALLY added a subject line, as you requested. Please tell us what happens when you try it and why it would not work.
Copy link to clipboard
Copied
Yes, I tried this suggustion
Change this line:
this.mailForm(false, email);
To this:
this.mailForm({bUI: false, cTo: email, cSubject: cSubLine});
and the result was when you click the submit button, nothing happend...... R
Copy link to clipboard
Copied
Nothing, nothing at all? Did you check the JavaScript console for errors?
Copy link to clipboard
Copied
Do you need us to tell you how to check the JavaScript console for errors?
Copy link to clipboard
Copied
> It's supposed to submit a PDF
Actually, it's supposed to submit an FDF file. If you want to submit the PDF use mailDoc, not mailForm.
Copy link to clipboard
Copied
Have you read this article:
https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/
If nothing is happening, then there is a problem. The first thing to do when there is a problem is check the console, as Mr. Screen as already indicated. But its also good to look up the code in the reference, so you get it right.
Copy link to clipboard
Copied
Hi Thom,
I don't know what the JavaScript console is? I did read the first articale before ever posting here. I'm just at a loss, so thanks for your input. The file that attaches to the email is actually an FDF file.
R
Copy link to clipboard
Copied
You must read Thom's tutorial on this subject, then:
Copy link to clipboard
Copied
That tutorial is helpful and i found the console; however, it doesn't solve my issue on adding the subject line to the script....
Copy link to clipboard
Copied
What happened when you used the code I provided? Where did you place it? Can you share your file with us?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You misunderstood what I meant... Use this code:
var email = this.getField("Email To:").valueAsString;
var cSubLine = "Meeting Request Form";
this.mailForm({cTo: email, cSubject: cSubLine});
Copy link to clipboard
Copied
Good Morning, Try67
That did not work and when I clicked the submit button nothing happened. Here is what the error is in the console:
MissingArgError: Missing required argument.
Doc.mailForm:1:Field submit:Mouse Up
===> Parameter bUI.
MissingArgError: Missing required argument.
Doc.mailForm:1:Field submit:Mouse Up
===> Parameter bUI.
Copy link to clipboard
Copied
I went back and tried the first suggestion with this new code and replaced this line
this.mailForm({cTo: email, cSubject: cSubLine});
with this one
this.mailForm({bUI: false, cTo: email, cSubject: cSubLine});
This works and gives the email a subject line = Meeting Request Form
😀
Copy link to clipboard
Copied
It seems that the bUI parameter is required for mailForm (it's not for mailDoc, strangely).
Setting it to false will be ignored, though. You should set it to true.