SyntaxError: missing ; before statement 1: at line 2 Acrobat Pro X
- February 27, 2023
- 1 reply
- 3223 views
Hello,
I am new to JS. I am trying to conditionally format two fields. Field one is a dropdown menu called "niche size" with three options: Small, Medium, and Large. Field two is called "Number of Persons." I am trying to code so that:
If Small is selected, Number of Persons = 2
If Medium is selected, Number of Persons = 3
If Large is selected, Number of Persons = 4
I keep getting the error: SyntaxError: missing ; before statement 1: at line 2 even though there is a semicolon after at the end of line 1. I am totally new at this and am probably missing something easy or am doing something glaringly wrong. Help is greatly appreciated. Code below:
var Niche Size = this.getField("Number of Persons").valueAsString;
if (Niche Size =="Small") event.value = 2;
else if (Niche Size =="Medium") event.value = 3;
else if (Niche Size =="Large") event.value = 4;
else event.value = "";
