Call Us At: 701.866.2098

Acro-JavaScript: Custom Submit Button


Developer Software Required: Adobe Acrobat A.K.A Adobe Acrobat Pro
End User Software Required: Adobe Reader A.K.A. Adobe Acrobat Reader

When a fillable .pdf is opened in Adobe Reader and filled in, typically the end user will save the .pdf with the contents entered, then email the document to the designated recipient. However, if you are the creator of these forms or if you have Adobe Acrobat, you can modify these forms to incorporate a custom submit button. This will effectively remove a few steps and make the process of sending .pdf documents more efficient for the end users!

Goal: End users will be able to fill in form then simply hit the submit button. An email will be drafted automatically with their default email client along with the attached form and the contents they entered.

  1. To add the custom submit button, open the .pdf form in Adobe Acrobat and select Prepare Form.
    Adobe Acrobat Prepare Form
  2. Insert a button and name it “Submit.”
    Adobe Acrobat Insert Button
  3. Right-mouse click on the new submit button and select Properties. In the Button Properties, under the General tab, change the Form Field to Visible but doesn’t print.Adobe Acrobat Button Visibility
  4. Within the Button Properties, navigate to the Actions tab. Select Trigger: Mouse Up, Select Action: Run a JavaScript.Adobe Acrobat Button Actions
  5. Paste the following code into the text editor, then modify to your preferred details.
    this.getField("submit").hidden = true;
    
    var cToAddr = "travis@offtherichterdesign.com"
    var cCCAddr = "service@offtherichterdesign.com"
    var cBody = "Off The Richter Design: Business Training Request\n" + "\nThe attached file is the filled-out form. Please open it to review the data."
    var cSubLine = "Business Training Request"
    this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr, cSubject: cSubLine + "Off The Richter Design", cMsg: cBody});
  6. Save the document and test the functionality.

3 Comments

  1. Reply

    I’m impressed, I must say. Rarely do I come across a blog that’s equally educative and engaging, and let me
    tell you, you have hit the nail on the head. The problem is something which too few
    people are speaking intelligently about. Now i’m very happy that I stumbled across
    this during my search for something regarding this.

  2. Reply

    I think other site owners should take this site as an model – very clean and great style and design, not to mention the content. You’re an expert in this topic!

  3. Steven

    Reply

    Thank you! Awesome write up. Simple and easy to follow. The script worked perfectly. Thanks!

Leave a comment

Your email address will not be published. Required fields are marked *