Help With For Loop, Field Names
This is a stub from a project. My goal is to look through all the fields in the document, then put any of them whose name begins with "topPh" (they all end in numbers) into my array fields[]. I'm still researching how to decide which names conatin the substring for the if statement, but in the meantime I am testing using this:
var fields = [];
for (var i = 0; i < this.numFields; i++){
var f = this.getField(this.getNthFieldName(i)).name;
if(f = "topPh2") fields.push(f);
} //end of for loop
app.alert(fields);I expected it to put one value in fields[]: topPh2. It seems to be doing it many times. In fact, I crashed Acrobat through console doing something similar. This is what it puts out:

What am I doing wrong here?
