Javascript using Checkbox reference to submit

New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

I have a form with a submit button that sends the form to certain email address.  I have a check box for a specific part of the form that when checked, would add another email to the submit button.  The submit button works fine but i can not figure out how to get it to look at the check box and if checked, add an additional email address when it is submitted.  

TOPICS
Acrobat SDK and JavaScript

Views

136

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

Javascript using Checkbox reference to submit

New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

I have a form with a submit button that sends the form to certain email address.  I have a check box for a specific part of the form that when checked, would add another email to the submit button.  The submit button works fine but i can not figure out how to get it to look at the check box and if checked, add an additional email address when it is submitted.  

TOPICS
Acrobat SDK and JavaScript

Views

137

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
Jun 15, 2020 0
Most Valuable Participant ,
Jun 15, 2020

Copy link to clipboard

Copied

Post your current code, please, as well as the name of the check-box in question.

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...
Jun 15, 2020 0
New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

So i have my submit button coded to do two things currently 

First is to submit the form using that function from the Action

The second thing it does is Reset the Form.  

I have not attempted to code the 3rd action to the point it is saved and not working.  What i have tried didn't work since i am new to this so i just cleared it out.  Here is a photo of the properties of my submit button. 

Lastly, the check box i need to reference is called OtherWorkadobe help.png

 

 

 

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...
Jun 15, 2020 0
Most Valuable Participant ,
Jun 15, 2020

Copy link to clipboard

Copied

You have to do it all using a script.

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...
Jun 15, 2020 0
New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

Would you mind assisting me with what that script would look like? 

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...
Jun 15, 2020 0
Most Valuable Participant ,
Jun 15, 2020

Copy link to clipboard

Copied

You didn't answer my question regarding the name of the check-box, so I assumed it's "Checkbox1".

Here's the code:

 

var toAddress = "me@gmail.com";
if (this.getField("Checkbox1").valueAsString!="Off") toAddress+=";john@gmail.com";
this.mailDoc({cTo: toAddress});
this.resetForm();

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...
Jun 15, 2020 0
New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

Thank you so much for your help

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...
Jun 15, 2020 0
New Here ,
Jun 15, 2020

Copy link to clipboard

Copied

I do have one more question, how would i add so that the Subject line is populated with a certain Text Field which is called Trailer Number?

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...
Jun 15, 2020 0
try67 LATEST
Most Valuable Participant ,
Jun 15, 2020

Copy link to clipboard

Copied

Like this:

 

var toAddress = "me@gmail.com";
var msgSubject = this.getField("Trailer Number").valueAsString;
if (this.getField("Checkbox1").valueAsString!="Off") toAddress+=";john@gmail.com";
this.mailDoc({cTo: toAddress, cSubject: msgSubject});
this.resetForm();

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...
Jun 15, 2020 1