21 Replies Latest reply on Dec 4, 2017 9:28 AM by Thom Parker

    Submitting form based on 2 dropdown selections - Javascript

    jasonk16545182

      Literally a noob when it comes to javascripting. I'm wanting to send a pdf form based on 2 dropdown selections when selecting a submit button. I could be miles out or so close but literally have no idea of what I'm doing at this level. What I achieved so far is from scanning the web. ***Please note I am using a Adobe Acrobat Pro DC

       

      Dropdown 1 = Head Office and Sub Team

      Dropdown 2 = Constructive and Electrical

       

      Code iv tried so far but its ignoring my command:

       

      var Dropdown1 = this.getField("Dropdown1").value;

      var Dropdown2 = this.getField("Dropdown2")value;

       

      var email = "";

       

      if ("Dropdown1" == "Head Office" && "Dropdown2" == "Constructive")

      {

      var email = "jasonsdking@me.com, constructive@hotmail.com";

      }

       

      else if ("Dropdown1" == "Head Office && "Dropdown2" == "Electrical")

      {

      var email = "jasonsdking@me.com, electrical@hotmail.com";

      }

       

      else if ("Dropdown1" == "Sub Team" && "Dropdown2" == "Constructive")

      {

      var email = "jasonsdking1@me.com, constructive@hotmail.com";

      }

       

      else if ("Dropdown1 == "Sub Team" && "Dropdown2" == "Electrical")

      {

      var email = "jasonsdking1@me.com, electrical@hotmail.com":

      }

       

      else

      {

      email = "kingysnewstart@Hotmail.co.uk"

      }

       

      if (email !="")

      {

       

      this.submissionForm({

      c.URL: "mailto:" + email,

      cSubmitAs: "PDF"

       

      });

      }

       

      Currently it attaches to an email addressed to kingysnewstart@Hotmail.co.uk and blanks my commands of picking from the two drop downs. Please note all emails are fake except the personal ones jasonsdking@me.com and Kingysnewstart@Hotmail.com for privacy reasons., and that there will be 20+ emails addresses for each selection.

       

      It would be ideal if  the title read - SRI: Dropdown1 Option + Dropdown 2 Option, and also that specific fields are filled in before sending (Text box 1 and text box 2)

       

      Please assist if possible, probably asking a bit to much to be honest.

       

      Regards

      Jason King