Skip to main content
Ryan_Oliver_02445
Known Participant
Jan 18, 2019 5:23 PM UTC
Answered

Syntax error: "Missing ; before statement" for simple javascript

I keep getting this syntax error, "Syntax error: "Missing ; before statement 3 and 4."  Basically, I doesn't like, String Last = this.getField("Last Name");

Here is the code I have:

this.documentFileName.replace(/.pdf/,"");

String First = this.getField("First Name");

String Last = this.getField("Last Name");

String Middle = this.getField("Middle Initial");

String State = this.getField("State");

String Patient = Last + ", " + First + " " + Middle;

The goal is the code to compare the file name to the patient's name in the PDf form fields.  I haven't written the rest yet until I can get this syntax error sorted out.

Any help would be appreciated!

This topic is closed to new replies. Start a new post to keep the conversation going.
Bernd Alheit
Bernd AlheitCorrect answer
Community Expert
Jan 18, 2019 5:36 PM UTC

Remove the String keywords.

3 replies

Legend
Jan 18, 2019 10:34 PM UTC

"String" is found in Java, where it is needed. It's a very natural thing to do to write JavaScript as Java Script or assume Java is short for JavaScript. Unfortunately, if you feed this into Google, you're going to get examples of how to write Java, which is not at all useful to you...

Translate
Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
Jan 18, 2019 5:36 PM UTC

Remove the String keywords.

Translate
Ryan_Oliver_02445
Known Participant
Jan 18, 2019 5:56 PM UTC

Thank you, I changed the "String" to "var" and now it works perfectly.  Thank you!

Translate