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.
Copy link to clipboard
Copied
Post your current code, please, as well as the name of the check-box in question.
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 OtherWork
Copy link to clipboard
Copied
You have to do it all using a script.
Copy link to clipboard
Copied
Would you mind assisting me with what that script would look like?
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();
Copy link to clipboard
Copied
Thank you so much for your help
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?
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();
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?
Copy link to clipboard
Copied
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