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

Javascript using Checkbox reference to submit

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

841

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
community guidelines
Community Expert ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
New Here ,
Jun 15, 2020 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

 

 

 

Votes

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
community guidelines
Community Expert ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

You have to do it all using a script.

Votes

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
community guidelines
New Here ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Community Expert ,
Jun 15, 2020 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();

Votes

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
community guidelines
New Here ,
Jun 15, 2020 Jun 15, 2020

Copy link to clipboard

Copied

Thank you so much for your help

Votes

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
community guidelines
New Here ,
Jun 15, 2020 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?

Votes

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
community guidelines
Community Expert ,
Jun 15, 2020 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();

Votes

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
community guidelines
New Here ,
Jul 18, 2024 Jul 18, 2024

Copy link to clipboard

Copied

Hello, I have a question pretaining to this community. What if there are 3-5 checkboxs that I want to submit an email to different list of DL's and mail based users what would that script look like?

Votes

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
community guidelines
Community Expert ,
Jul 18, 2024 Jul 18, 2024

Copy link to clipboard

Copied

LATEST

Here's an article with a sample file that shows how to do this with a selection from a dropdown. It could easily be modified to use a checkbox.

https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address/

 

Here's an article on programming with checkboxes. 

https://www.pdfscripting.com/public/Checkboxes-and-Radio-Buttons.cfm

 

 

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

Votes

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
community guidelines