Skip to main content
qrparker
Participant
April 7, 2023
Question

Var is undefined?

  • April 7, 2023
  • 2 replies
  • 833 views

As recently as three days ago I used this code to extract fields from a dropdown: 

var oFld = this.getField("MyField-01");

for(var i=0;i<oFld.numItems;i++) {

  console.println(oFld.getItemAt(i,true));

}

Now whenever I run it I get the following error:

SyntaxError: syntax error
1:Console:Exec
undefined

 I've triple checked that the field value name is correct, and the dropdown has over 150 values. I have no idea what the issue is. Does anyone have any idea?

This topic has been closed for replies.

2 replies

Legend
April 7, 2023

You are not the first to be confused by the word "undefined". This is not an error, or even a warning. It is telling you the last value from the last line executed. Most working code will end up saying "undefined" or a number.

The key here is the first line, syntax error. A syntax error is something specific - something it cannot understand. It is not a mis-spelled variable name, but something like a forgotten semi-colon.

I suspect that this is not the exact code you ran, and there is a typing or copy/paste issue. Please show a screen shot of the actual code in Acrobat.

Nesa Nurani
Community Expert
Community Expert
April 7, 2023

Where do you use script?

Can you share file?