• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 878
  • Last Modified:

PDF: How to email selected recipient based on combo box value

Dear Experts,

I am trying to figure out a way to email the attached form to a different instructor based on the course selected in the course dropdown field. Right now I am using the mouse up event on the Email button to send to a URL (mailto:recipient....)  This method, however, forces me to create several different forms all with a different mailto address for the instructor regardless of what is selected in the dropdown.

To save a great deal of time, I am wondering if there is any javascript I could run that would check the value in the dropdown and based on that value send an email to the appropriate instructor for that course - some sort an array in javascript or....

Any help would be most appreciated.
okinawa-district-course-registat.pdf
0
shogun5
Asked:
shogun5
  • 2
  • 2
1 Solution
 
Karl Heinz KremerCommented:
You can use JavaScript. Take a look at the JavaScript API document here:
http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?href=JS_Dev_Overview.71.1.html&accessible=true

There is a method to submit a form: Doc.submitForm()
http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJS.88.532.html

Have you done anything with JavaScript and Acrobat yet? Here is the outline of what you need to do: Create a submit button that executes a JavaScript. Create a JavaScript program that gets the selected course and then selects an email, and as the last step submits the form to the selected email address. Take a look at the attached code:

// get the course name
var course = this.getField("course").value;
console.println("course: = " + course);

var email = "";

if (course == "          - Select a Course -")
{
   app.alert("You need to select a course first");
}
else if (course == "Hands-On Science")
{
    email = "bob@example.com";
}
else if (course == "6 Traits – Strategies, Assessments and Rubrics – K-6")
{
    email = "judy@example.com";
}
else
{
    email = "admin@example.com";
}

if (email != "")
{
    this.submitForm("mailto:" + email);
}

Open in new window

0
 
shogun5Author Commented:
This works but when I submit the form now the attached form is fdf and not pdf. What can I do to ensure the entire pdf form is sent in the attachment.

Normally I select Submit Form as the action and ensure the entire PDF is checked. See screenshot.

Thanks!
screenshot.png
0
 
Karl Heinz KremerCommented:
Take a look at the documentation for the submitForm() method - the cSubmitAs parameter lets you select in which form the data will get submitted.

You would use something like this:

      this.submitForm({
            cURL: "mailto:themail@address.com",
            cSubmitAs: "PDF"
      });
0
 
shogun5Author Commented:
Right! That did it! Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now