Highlighted

Is there a way to send form data in the body of an email using javascript ?

New Here ,
Sep 25, 2020

Copy link to clipboard

Copied

Hi everyone, 

First of all, sorry for my english. 
So I made a fillable form in acrobat and I wanted to send only the content of  the form via e-mail.
But (using the "submit a form" option) I always end up with a file attached to the mail (fdf, xfdf, etc). That's not what I want 🙂
I just want to send the content of the filled form, is it possible ? Maybe in JS (I'm a complete noob)?

Thanks

TOPICS
PDF forms

Views

158

Likes

Translate

Translate

Report

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

Is there a way to send form data in the body of an email using javascript ?

New Here ,
Sep 25, 2020

Copy link to clipboard

Copied

Hi everyone, 

First of all, sorry for my english. 
So I made a fillable form in acrobat and I wanted to send only the content of  the form via e-mail.
But (using the "submit a form" option) I always end up with a file attached to the mail (fdf, xfdf, etc). That's not what I want 🙂
I just want to send the content of the filled form, is it possible ? Maybe in JS (I'm a complete noob)?

Thanks

TOPICS
PDF forms

Views

159

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 25, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

Take a look at the Acrobat JavaScript API document: 

 

The doc.mailDoc() method has a way to specify all parts of an email message: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJ...

 

There is no ready made function that would just add the form contents to the body of an email message, but you can assemble that message as a string, and then use that string to populate the body of your email. It's a bit more complex than just calling a function, but it can be done. 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Most Valuable Participant ,
Sep 25, 2020

Copy link to clipboard

Copied

If they do that it will still email the file, though, which is what they wanted to avoid doing... In order to do that they will have to use app.mailMsg (which only works in Acrobat), or, and this is a bit of a hack, use app.launchURL to open a mailto link with the contents of the message. The latter is limited in the number of characters it can send, though.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

Vous devriez jetez un œil à ce superbe document d'exemple : https://www.abracadabrapdf.net/pdf-de-demo/formulaires/formulaire-de-contact/

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
New Here ,
Sep 28, 2020

Copy link to clipboard

Copied

Hello,

And a big thanks/merci to everyone, that's what I did and it kind of work the way I wanted :

 

app.mailMsg({
     bUI: false,
     cTo: "paul@studiofables.com",
     cSubject: "J'ai une question pour RNEST",
     cMsg: "Prénom : " + this.getField("Prenom").value +
                "\nNom : " + this.getField("Nom").value +
                "\nOrganisation : " + this.getField("Org").value +
                "\nE-mail : " + this.getField("Mail").value +
                "\nQuestion : " + this.getField("Question").value
});

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
Most Valuable Participant ,
Sep 28, 2020

Copy link to clipboard

Copied

Keep in mind this will not work if the file is opened in Adobe Reader!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
New Here ,
Sep 28, 2020

Copy link to clipboard

Copied

I know but for some reason and mostly because, as I said, I'm noob, I can't get the app.launchURL to work.
But it's already a huge step for me.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
Most Valuable Participant ,
Sep 28, 2020

Copy link to clipboard

Copied

Here's the basic code to do it:

 

var cTo = "paul@studiofables.com";
var cSubject = "J'ai une question pour RNEST";
var cMsg = "Prénom : " + this.getField("Prenom").value +
	"\nNom : " + this.getField("Nom").value +
	"\nOrganisation : " + this.getField("Org").value +
	"\nE-mail : " + this.getField("Mail").value +
	"\nQuestion : " + this.getField("Question").value;
app.launchURL("mailto:"+cTo+"?subject="+escape(cSubject)+"&body="+escape(cMsg));

 

However, I noticed that the accented characters are not being displayed correctly, despite the escape command. It might be needed to encode them differently, for example with unicode characters or something like that.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
New Here ,
Sep 28, 2020

Copy link to clipboard

Copied

Thank you, but it makes my acrobat crash... 😄

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0
Adobe Community Professional ,
Sep 28, 2020

Copy link to clipboard

Copied

Concernant la gestion des caractères accentués il faut absolument lire cet article-tuto :

https://www.abracadabrapdf.net/ressources-et-tutos/js-et-formulaires-ressources/pdf-javascript-et-un...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 0