Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box and document array to work with spawning

Status
Not open for further replies.

Eprice

Technical User
May 6, 2003
209
US
Hi,
I have a form that I need to spawn pages. As it is now I have a document array and a combo box. When a selection is made in the combo box, the StateAmt field is populated from the array. This all works fine now, but I need to be able to make this coding work with spawned pages and need a little help.

This is my document javascript:
var gState = new Array //Create a reference to a new array
//load the array up with the amounts for each state
gState["AL"]=40
gState["AK"]=40
gState["AR"]=40
gState["AZ"]=25
gState["CA"]=25
....and so on, I deleted most to make the script shorter here

this is my custom keystroke script for combo box 'gstate' (fyi, i added the state initials in the combo box options tab)
var stateamt = this.getField("G876.StateAmt")
if (event.changeEx in gState)
stateamt.value = gState[event.changeEx]

this works great for one page but when I add another page (spawned template) nothing happens after makeing a selection in the combo box. I'm sure I need to alter the script due to spawing changes the field names on each page, but I don't know how. I tried renaming the combo to gState1 and using this script (which does not work)

var fna = event.target.name.split(".");
var fp = fna.length>1?fna[0]+"."+fna[1]+".":"";
var stateamt = this.getField(fp + "G876_StateAmt").name // (this is G876.StateAmt on the original form)
var gst = this.getField(fp + "gState1").name //(this is gState on the original form)

if (event.changeEx in gst)
stateamt.value = gst[event.changeEx]


If anyone can help me with this, I would be so greatful.
Thanks
Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top