Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Javascript to send e-mail using fields within form

New Here ,
Aug 21, 2013 Aug 21, 2013

I am trying to write a javascript that will send an e-mail when a checkbox is checked that will include certain fields from the form within the body of the e-mail.  Is this possible?

TOPICS
PDF forms
41.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2013 Aug 21, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2013 Aug 21, 2013

I have tried refering to the tutorial that you mentioned but I am not familar with javascript at all.  When I copied and pasted the codes...nothing happens so I'm not sure what I am doing wrong.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 21, 2013 Aug 21, 2013

Yuki,

You need to modify the script to suit your form.

What are the field names on your form that you want to include in the email?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2013 Aug 21, 2013

here is the code that I copied and used

// This is the form return e-mail. Its hardcoded

// so that the form is always returned to the same address

// Change address on your form

var cToAddr = "gleeherr@tuftsmedicalenter.org";

// Set the subject and body text for the e-mail message

var cSubLine = this.getField("generic name trade if applicable").value + this.getField("Strength").value + this.getField("Dosage Form").value;

// Send the form data as an PDF attachment on an e-mail

this.mailDoc({bUI: true, cTo: cToAddr, cCc: cCCAddr,

  cSubject: cSubLine, cMsg: cBody});

I want the subject field to Generic name trade if applicable + strength + dosage form

Also, is there a way for the e-mail to just automatically send without having the user to actually hit the send button in outlook?  When i distribute the form without the submit buttons, it automatically creates a submit button and when the end user hits the submit button, an e-mail automatically gets generated with the filled-in pdf attached and sent automatically to the owner of the form's e-mail.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 22, 2013 Aug 22, 2013

Also, is there a way for the e-mail to just automatically send without having the user to actually hit the send button in outlook?

Only if a special script is installed on the local machine of each user of the file.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2018 Sep 07, 2018

What would this script look like? I would love to see a sample for a system I'm working on.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 07, 2018 Sep 07, 2018

A better approach is to submit the data to a web-server. At any rate, due to security reasons, it won't be completely automatic. The user will have to approve sending the data, at least once.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2018 Sep 07, 2018

I'm having trouble submitting the data to a web-server. I put the url of a directory on our website to hold the results of the submit (www.lsefspartans/public_html/wp-content/uploads/).

When I press submit I get the message:

This document is trying to connect to:

file:///c|/users/mona_/documents/web%20development/grants/www.lsefspartans/public_html/wp-content/uploads/

Which doesn't exist. It's appending the directory that I downloaded the pdf to with the URL I put in the submit button.

I therefore get the message: Error opening URL to submit this form.

Any ideas? Thanks in advance!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2018 Sep 07, 2018

monab1  wrote

I'm having trouble submitting the data to a web-server. I put the url of a directory on our website to hold the results of the submit (www.lsefspartans/public_html/wp-content/uploads/).

That's now how it works. Your server has to be set up with a program that's designed to properly respond to a submitted form. There are all sorts of technical details that I'm not going to get into, but it's not as simple as you've assumed.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2018 Sep 07, 2018

Do you know where I can find documentation/instructions on how to write that program? Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2018 Sep 07, 2018

The following discusses the basics: Sending form data - Learn web development | MDN

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 11, 2021 Oct 11, 2021

Hello,

 

Can you help me write a java script?  I have an Adobe sign form with an email field set as a required field that will be sent out via email. I want to ensure that a complete email address is provided when the form is completed. Can you help with this?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2021 Oct 11, 2021

This is not possible in an Adobe Sign form.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 11, 2021 Oct 11, 2021
LATEST

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 12, 2020 Jan 12, 2020

Can anyone help me doing this work for mobile? As my script is working fine on PC but not submitting the form on Andriod device. What can add to my script to make it work for mobile too?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2020 Jan 14, 2020

Mobile viewer don't support the same level of JavaScript. So you can't. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 15, 2020 Jan 15, 2020

Any alternate way of doing this on mobile??

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 15, 2020 Jan 15, 2020
Any alternate way of doing this?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2020 Jan 15, 2020

A script is the only way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2019 Mar 26, 2019

Ok, I have this work along time ago. Doing new fun projects now.

So How do I email only one of the pages of the PDF without extracting the one page?

//this.Page# ({bUI: true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2019 Mar 27, 2019

Not possible. You have to either extract the page you want to send or delete the pages you don't want to send.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines