3 Replies Latest reply on Aug 11, 2016 7:40 AM by try67

    Scripting help with submit button.


      My employer has assigned me the task of creating pdf forms to replace several older HR forms that currently have to be printed and filled out by hand.  Many of these forms are very straight forward however I have a unique challenge in regards to creating a vacation request form.  The HR manager wants to have the form so that once the requester clicks on the submit button, the email is sent to the immediate supervisor based upon the department that they chose from a drop down menu.  The field name is named Department and has the following options: Admin, IT, Sales, Service.  Is there a was for me using JavaScript to code the submit button so that it can send to the appropriate email address based upon the department they select in the form?  Thanks in advance.

        • 1. Re: Scripting help with submit button.
          try67 MVP & Adobe Community Professional

          Yes, it can be done using JS. The first step is to use the Export Value of each item in the drop-down as the email address that you want to use. So let's say you have an item called "IT". Edit it so that the "Item" value is "IT" and the "Export Value" is the email address for that department, for example "JohnD@it.ourcompany.com".

          After you've done that the script you need to use is very simple. Basically it's only this (let's say the drop-down field is called "Dept"):


          this.mailDoc({ cTo: this.getField("Dept").value });
          • 2. Re: Scripting help with submit button.
            jasonc0604 Level 1

            Is there a way to do it that once the user hits submit it doesn't prompt to open their desktop email application or webmail interface?  Is there a way to code in an email account to send from and all it tells the end-user is that their request has been submitted?

            • 3. Re: Scripting help with submit button.
              try67 MVP & Adobe Community Professional

              No, not possible with email. What can be done, though, is to submit the data to a service that's running on a web-server. That can be done silently (ie, without further user interaction beyond pressing the Submit button) and it can even return a message if the data was successfully received.


              If you're interested I've developed a PHP script that does just that. You can contact me privately for details.