Skip to main content
Participant
July 25, 2022
Question

Keep getting undefined

  • July 25, 2022
  • 4 replies
  • 3265 views
I have over 1600 over different pages that I need to have different values. I try to use this code I found online. undefined keeps popping up every time. Can I get help? 


for
(var i=0;i<200;i++) { try{ var rct=this.getField("Name1."+i).rect; var pg=this.getField("Name1."+i).page; this.addField("name."+i,"text",pg,rct); }catch(e){break} }
This topic has been closed for replies.

4 replies

Bernd Alheit
Community Expert
Community Expert
July 26, 2022

Where does you use the script?

try67
Community Expert
Community Expert
July 25, 2022

If you want to locate errors in your code the first step is to remove the try-catch clause which hides them from you, or at the very least add a command to the catch part which prints out the error message that triggered it...

Legend
July 25, 2022

What do you mean by "undefined keeps popping up"? It's normal and not an error, in the console, for example. 

Participant
July 26, 2022

I'm not a programmer so trying to figure this out is pretty hard for me. I'm trying to change all the text fields name that have the same name to a different one so they won't have the same value. I took out catch(e){break} to see if they're any error. The only thing that pops up is undefined and nothing happens. 

Legend
July 26, 2022

Ok, you've just come round to "undefined pops up". We don't know what you mean, but in programming every detail matters. So please share a screen shot of what you see.

Also, what are the current, exact field names, and what is the exact effect you want to have. Not roughly, but exactly. It's the only thing that makes sense in programming, we can't guess anything about what you want to do. 

Participant
July 25, 2022

1600 text field