Print Page | Close Window

build email text from PDF form

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 21 Nov 2019 at 2:46pm
Software Version: Web Wiz Forums 11.10 -

Topic: build email text from PDF form
Posted By: lauracp
Subject: build email text from PDF form
Date Posted: 01 Aug 2018 at 6:57pm
Hi There,

I'm working on building a PDF form with a submit button that will email the completed form to a set address. I've run into a couple stumbling blocks and would greatly appreciate some help:

1) I can get the submit button to work when this form is opened and completed using almost every PDF application i can think of, except PDF X-Change Viewer. I'm not sure if there is anything specific I should know in order to make it work here also, any tips??

2) i used javascript to build the email subject line & body text from completed information from the form. everything seems to be working as i want it to except for checkboxes. I would like a checked checkbox to result in the value being populated into the body text of the email, and if left unchecked i would like no text to populate (blank). below returns the desired result when the box is checked, but returns "Off" when left unchecked.

        // Build message body
        var body_text = "";
        body_text += getField("checkbox").value;

if i change it to this

        body_text += getField("checkbox").exportValues;

I get the desired export value whether the box is checked or unchecked.

I figure i need some sort of IF/ELSE statement but i'm not sure how to word it correctly.

any thoughts?

thank you,

Posted By: try67
Date Posted: 02 Aug 2018 at 4:05pm
You can use this code to achieve it:

var cbValue = this.getField("checkbox").valueAsString;
if (cbValue!="Off") body_text += cbValue;

- Acrobat Expert - Contact me personally at
Check out my custom-made scripts website:

Posted By: lauracp
Date Posted: 02 Aug 2018 at 4:40pm
that seems perfect

any suggestions on how to separate the export values using a comma

thank you!

Posted By: try67
Date Posted: 16 Aug 2018 at 1:03pm
Something like this?

if (cbValue!="Off") body_text += cbValue + ", ";

- Acrobat Expert - Contact me personally at
Check out my custom-made scripts website:

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -