Getting a Field Name With a Generic Number
For my project, I have pages spawn from a template. I use a hidden form field containing a count variable which I append to the names of spawned fields and increment. There are fields such as topPh#, topCap#, etc. These numbers may or may not match with page numbers or be in sequential order.
- How can I make a loop that will go to each page and collect topPh# etc. regardless of the integer there? I also would want to have a list of the # values in order.
I used regular expressions to do something similar:
var num = event.target.name.match(/\d/g).join('');
this.getField("botPh" + num).display = (event.target.value=="Off") ? display.hidden : display.visible;
this.getField("botCap" + num).display = (event.target.value=="Off") ? display.hidden : display.visible;
But in the above case, my target widget has a number on it (e.g. togBot5), and it talks to other widgets with the same number (e.g. botPh5), regardless what the number is.
