PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ __________________________________________________________________
In your loop, you are using the variable "fieldOne" and saying it equals zero. Then you use the variable 'i' for the rest of your loop. Perhaps you mean: for (i=0; i<of1.options.length; i++) As mentioned before, your script is first assigning your "fieldOne" variable to "sponsor.", then on the very next line (in your loop) you assign a value of "0" to your variable "fieldOne". Does that help? Mark Lauterbach Forms Designer Citizenship and Immigration Canada 613.957.2798 "Reason has always existed, just not always in a reasonable form." -----Original Message----- From: kc [mailto:[EMAIL PROTECTED] Sent: March 31, 2004 12:16 PM To: PDF Forms List Subject: Re: [PDF-Forms] Make Multiple Selectios From List, Then Display in Three Text Fields PDF-Forms is a service provided by PDFzone.com | http://www.pdfzone.com/ __________________________________________________________________ Max and Mark Thank you much for the advice. Mark - the suggestioni to map out the code first with "pseudo logic" was helpful to me. I had to set aside the project yesterday (which was probably a good thing). This morning I revised my code as below and get an error saying: "ReferenceError: i is not defined." f1 = this.getField("sponsor"); f2 = this.getField("dmm1"); f3 = this.getField("dmm2"); f4 = this.getField("dmm3"); var fieldOne = "sponsor."; for (fieldOne = 0; i < of1.options.length; i++) { if (of1.options[i].selected) { if (f1.value == "") f1.value = selection; else if (f1.value != "" && f2.value == "") f2 = selection; else if (f1.value != "" && f2.value != "" && f3.value == "") f3 = selection; else app.alert("All fields are full"); } } I assume this has something to da with the for loop, but to me it looks sound. Max Is limiting the selection to three necesary to maket he rest of the script work? I ask because I was told by the end users of this form that they almost always select only one item from the list. They might select two items maybe 12 X a year, and have yet to select three. I did reference the Acrobat JavaScript Object Specification as you suggested for the currentValueindices. I placed this script in the "Selection Change' script box, but I am not clear what I do with this - is it supposed to be passed on to the script below that is working at "onblur"? In any event , it returns this message to me TypeError: f.getitemAt is not a function if (event.willCommit) { var f = event.target; var a = f.currentValueIndices; if (typeof a == "number") console.println("Selection; " + f.getitemAt(a, false)); else { console.printin("Selection:"); for (var1 = 0; 1 < a.length; i ++) console.println(" " * f.getItemAt(a[i], false)); } }. Here's some question for both of you (or anyone else who has some advice). 1. Am I close to acheiving my original goal of having the selected values from a multiple selection list box displayed into three separate text box fields? Because I want (scratch want, must have) this on user's desks, I am going to use Plan "B" which will be repeating the list box 3 times and let the user display their choice that way. My goal was to save space, because this form is really tight. 2. What do you recommend in the way of educational material for learning JavaScript. I am not a programmer, but have extended a couple of Acrobat forms and web pages using basic scripts. It's obvious that I need to get a true understanding of JS more than cutting, pasting and editing pre-existing scripts. It's kind of frustrating because I can see the power of extending the forms via the scripting, but I don't have the tools to implement the features. I've gotten pretty good mileage out of Creating Acrobat Forms by John Deubert; Extending Acrobat Forms with JavaScript by John Deubert; and Creating Adobe Acrobat Forms by Ted Padova. To change your subscription: http://www.pdfzone.com/discussions/lists-pdfforms.html To change your subscription: http://www.pdfzone.com/discussions/lists-pdfforms.html
