0
Community Beginner
,
/t5/acrobat-discussions/hey-getting-syntaxerror-missing-after-for-loop-initializer/td-p/13072104
Jul 15, 2022
Jul 15, 2022
Copy link to clipboard
Copied
Hey yall im getting the above error when trying to execute the following for loop.
var prodLength = product.length;
for(let i = 0; i < prodLength; i++) {
if (product[i][5] > 0) {
if(quPn1.length <= 0) {
quPn1 = product[i][1];
} else if(quPn1.length >= 0) {
if(quPn2.length <= 0) {
quPn2 == product[i][1];
} else if(quPn2.length >= 0) {
if(quPn3.length <= 0) {
quPn3 == product[i][1]
}
}
}
} else if (product[i][5] <= 0) {
// code
}
};
product is a 2d array of variables refrenced to text fields eg.
const product = [
[caPn1,caDsc1,caWe1,caUp1,caVol1,caTot1]
[caPn2,caDsc2,caWe2,caUp2,caVol2,caTot2]
var caPn1 = String(this.getField("CaPn1").valueAsString);
var caPn2 = String(this.getField("CaPn2").valueAsString);
The end goal of the for loop is to loop through the 2d array checking for values greater than 1 in the fifth element of the interior array and if a value is seen to check a text field for text and if it is empty fill it with an element from the array. Thanks ahead of time for your help!
TOPICS
JavaScript
,
PDF forms
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 ACCEPTED SOLUTION
Community Expert
,
LATEST
/t5/acrobat-discussions/hey-getting-syntaxerror-missing-after-for-loop-initializer/m-p/13072293#M370760
Jul 15, 2022
Jul 15, 2022
Copy link to clipboard
Copied
Replace let with var
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/acrobat-discussions/hey-getting-syntaxerror-missing-after-for-loop-initializer/m-p/13072293#M370760
Jul 15, 2022
Jul 15, 2022
Copy link to clipboard
Copied
Replace let with var
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

