Copy link to clipboard
Copied
Hi,
I am working on a PDF form when the send button is clicked, certain information is transferred to the body of the email. What I am having issues or can't figure out is, if I have a blank text box or selection, I want it to be skipped and not transferred to the body of the email. The name of the text boxes are 1.OM 2. BOV 3. Blast. The input will be placed after ".getField("Document Orientation") the code is below:
// JavaScript Document
{
var cToAddr = this.getField("designer").value;
// Set the subject line
var cSubLine = "Graphic Request" + " " + this.getField("Project Name").value;
//this is what will be displayed in the body of the email
var cBody = "Hi,"
+ "\n\n"
+ "Project leader for the request:"
+ "\n"
+ this.getField("Project_Lead_1").value + " "
+ "\n"
+ this.getField("Project_Lead_2").value + " "
+ "\n\n"
+ "The name of the project is" + " "
+ this.getField("Project Name").value + "."
+ "\n"
+ "Comments:" + " " + this.getField("Comments").value
+ "\n\n"
+ "Document of Type:"
+ "\n"
+ this.getField("Type").value + ", " + this.getField("Document Size").value + ", "
+ this.getField("Document Orientation").value;
// Send the entire PDF as a file attachment on an e-mail
this.mailDoc({bUI:true, cTo: cToAddr, cSubject: cSubLine, cMsg: cBody});
}
Yes, it is. Set the value you want to display as the export value (or "radio choice value") of the field, and then use this code:
if (this.getField("OM").valueAsString!="Off") cBody+=this.getField("OM").valueAsString+"\n";
Copy link to clipboard
Copied
Use something like this:
if (this.getField("OM").valueAsString!="") cBody+=this.getField("OM").valueAsString+"\n";
Copy link to clipboard
Copied
Thank you for your quick response. I added the code but now its coming up as "off".
Copy link to clipboard
Copied
sorry, hit the button by mistake. When the check box is not selected, it is showing up as "off" on the email. Also, if the check box is selected, its showing up as "yes" instead of the selection.
Copy link to clipboard
Copied
You said it was a text field...
Copy link to clipboard
Copied
Sorry if that wasn’t clear enough. Can it be done with radio or check boxes?
Copy link to clipboard
Copied
Yes, it is. Set the value you want to display as the export value (or "radio choice value") of the field, and then use this code:
if (this.getField("OM").valueAsString!="Off") cBody+=this.getField("OM").valueAsString+"\n";