6 Replies Latest reply on Aug 22, 2011 6:10 AM by TPanchella

    Cany you link a combo box to a submit form button?

    TPanchella

      This question pertains to Adobe Acrobat 9 Standard.

       

      On my form, I have a combo box that lists 5 names and a button that I want to use to submit the form via email. 

       

      Based on the combo box selection, I want the submit button (when pressed) to submit the completed form directly to the email address that corresponds to the name selected.

       

      Is there a way to do this?

       

      Any help will be greatly appreciated!

        • 1. Re: Cany you link a combo box to a submit form button?
          George_Johnson MVP & Adobe Community Professional

          If you set the export value of each list item to the corresponding email address, you ca retrieve the address by getting the value of the combo box. You can then send the PDF as an email attachment to the specified address using the mailDoc method. The documentation has some sample code that should help: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.505.html

           

          And here's a previous topic that discusses this a bit more: http://forums.adobe.com/message/3806273

           

          You just have to replace the hardoced value of the cTo parameter with the value you retrieve from the combo box.

           

          The other option is to use the submitForm method and include the email address in the mailto type URL.

          1 person found this helpful
          • 2. Re: Cany you link a combo box to a submit form button?
            TPanchella Level 1

            George,

             

            Thank you so much for your prompt response and I apologize for not writing back sooner.

             

            The situation has changed slightly since last week.

             

            The form contains a combo box (called Industry) with 16 choices.  Selection of an Industry automatically populates a text box (called Executive) with the name of the executive in charge of that particular industry.

             

            What I want to do, if possible, is based on the Executive text box, I want the Submit Button (when pressed) to automatically email that particular executive.

             

            The Submit Button is currently set to email the PDF to one email address that I had to preset and that's not what I want it to do.

             

            Is there any way around this?

             

            Thank you again.  I really appreciate your help with this.

             

            Tara

            • 3. Re: Cany you link a combo box to a submit form button?
              George_Johnson MVP & Adobe Community Professional

              How exactly are you setting the text box to the name of the corresponding executive? There are a number of ways to do this, you just need some way of associating an email address with the name and/or industry. This can either be the export value of the combo box items or in code. For example, the export value of each item can include the name and email address, separated by a delimiter. You will then be able to parse out the name and email address when needed.

               

              Or you could set up an object that you use to associate an industry with the corresponding name and emai address. For example:

               

              // Set up object to associate a name and email address with an industry name
              var ind_data = {
                  "Industry 1" : {name: "John Doe", email: "johndoe@example.com"},
                  "Industry 2" : {name: "Jane Smith", email: "jsm@bogus.gov"},
                  "Industry 3" : {name: "Bob", email: "bob@bob.com"}
              }
              

               

              You can then look up the name and email address given the industry:

               

              // Get the industry from the combo box
              var industry = getField("Industry").value;
              
              // Look up the name and email address
              var name = ind_data[industry].name;
              var email = ind_data[industry].email;
              

               

              This isn't complete, but it should give you an idea of the type of thing I'm talking about. Post again if you get stuck.

              1 person found this helpful
              • 4. Re: Cany you link a combo box to a submit form button?
                TPanchella Level 1

                The Industry combo box contains the following keystroke script:

                 

                // Custom Keystroke script for combo box
                (function () {

                if (!event.willCommit) {

                // Set up an array for arrays of industry corresponding to export values in this combo box
                var aIndustry = [];
                aIndustry[0] = ["--"]
                aIndustry[1] = ["Jen H"];
                aIndustry[2] = ["Al M"];
                aIndustry[3] = ["Steve T"];
                aIndustry[4] = ["Al M, Jen H, Steve T, Glen P"];
                aIndustry[5] = ["Al M"];
                aIndustry[6] = ["Al M"];
                aIndustry[7] = ["Steve T"];
                aIndustry[8] = ["Jen H"];
                aIndustry[9] = ["Glen P"];
                aIndustry[10] = ["Al M, Jen H, Steve T, Glen P"];
                aIndustry[11] = ["Steve T"];
                aIndustry[12] = ["Al M"];
                aIndustry[13] = ["Jen H"];
                aIndustry[14] = ["Jen H"];
                aIndustry[15] = ["Al M"];// Get the export value of the selected item
                var ex_val = event.changeEx;

                // Populate the combo box field with the industry
                getField("BD Executive").setItems(aIndustry[ex_val]);
                }

                })();

                 

                When one of the 15 industries are selected, the Executive field automatically populates with one of four names (or, in two instances, all four names).

                 

                Let's say I choose Construction as my Industry.  The Executive field automatically has Jen H's name.

                 

                When the form is complete and I click the Submit Button, I want it to submit the form by e-mail directly to Jen H.

                 

                So do I have to enter a script somewhere within the Executive field or the Submit Button field?

                 

                Please excuse my ignorance.  I'm very, very new to this.

                 

                Thanks again for everything!!!

                • 5. Re: Cany you link a combo box to a submit form button?
                  try67 MVP & Adobe Community Professional

                  For each item you can specify both a name and an export value, for example:

                   

                  aIndustry[1] = ["Jen H", "jenh@company.com"];

                   

                  Then you can use the export value in your submit script, like so:

                   

                  var recipientEmail = getField("BD Executive").value;

                  this.mailDoc(true, recipientEmail);

                  • 6. Re: Can you link a combo box to a submit form button?
                    TPanchella Level 1

                    Thank you, thank you, thank you!

                     

                    I really appreciate the help I received on this project.  I could not have finished it without the two of you.

                     

                    You just made my Monday!