Skip to main content
illiad1975
Participant
Sep 5, 2023 3:56 PM UTC
Answered

JavaScript Syntax Error

I'm just trying to create a mailDoc on Mouse Up for a submit button and I'm encountering a syntax error:

var sendForm = app.alert("Are you ready to submit to " + ProgramManager + "?",2,2,"Program Manager Submission");

if(sendForm) == 4) {
this.mailDoc({bUI:true,cTo:ProgramManagerEmail,cSubject:"Incident Report Submitted",cMsg:"A new Incident Report has been submitted.\n Please sign it and return it to the sender."});
}
else
app.alert("Please continue with the form");

 

I'm getting syntax error 3: at line 4. I'm hitting a wall, so I'm open to suggestions. ProgramManagerEmail is a variable that is set from a drop-down to select a user. That populates an email address in ProgramManagerEmail.

 

Thank you,

~ David

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
Sep 5, 2023 4:27 PM UTC

The parentheses on the "if" are not correct.

Should be this:

if(sendForm == 4) {

 

 

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

5 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
Sep 5, 2023 4:27 PM UTC

The parentheses on the "if" are not correct.

Should be this:

if(sendForm == 4) {

 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
illiad1975
Participant
Sep 5, 2023 5:11 PM UTC
Ugh, kept looking below not thinking about the if line.

Thanks so much!!!
Translate
Thom Parker
Community Expert
Community Expert
Sep 5, 2023 7:47 PM UTC

Many syntax errors (related to delimiters) are reported on the lines following the source of the error, because it's not apparent there is an error until a non-matching token is encountered. 

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often