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

Creating a submit form- check box values into subject line

New Here ,
Oct 02, 2024 Oct 02, 2024

I'm creating a form that submits a filled out PDF to a specific email. I have three check boxes, if one is selected that value goes into the subjectline.

 

The code I'm using right now is:

 

var targetEmail = "name@name.com";

var subjectLine = "Material Determination Transition Form Received for Plant(s) - " + " " + this.getField("Check Box 21").valueAsString + " " + this.getField("Check Box 22").valueAsString + " " + this.getField("Check Box 23").valueAsString;

this.mailDoc({cTo: targetEmail, cSubject: subjectLine});
(function () {

 

When I tested it, I checked two boxes and the subject line reads:

Material Determination Transition Form Received for Plant(s) - Off 2100 2200

 

The unchecked box leaves a value of "Off" in the subject line. If anyone can help in either hiding the Off or to change the unchecked value of all the check boxes to a blank would be greatly appreciated. Ty!

TOPICS
JavaScript , PDF forms
175
Translate
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
Adobe Employee ,
Jan 23, 2025 Jan 23, 2025

Hi, 


Sorry for the delay in responding to your question. I am inviting the top experts in this domain to update this discussion.
Hi, @try67   @Nesa Nurani, kindly check if you could add your thoughts on this for future visitors. 

 


~Tariq

Translate
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 ,
Jan 23, 2025 Jan 23, 2025
LATEST

Try this:

 

var targetEmail = "name@name.com";
var values = [];
var v1 = this.getField("Check Box 21").valueAsString;
if (v1!="Off") values.push(v1);
var v2 = this.getField("Check Box 22").valueAsString;
if (v2!="Off") values.push(v2);
var v3 = this.getField("Check Box 23").valueAsString;
if (v3!="Off") values.push(v3);
var subjectLine = "Material Determination Transition Form Received for Plant(s) - " + values.join(" ");
this.mailDoc({cTo: targetEmail, cSubject: subjectLine});
Translate
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