I want to have 50 or so check boxes on page 2 and when any 1 of the 50 are checked off it populates text field 1 on page one with the text. When a second one is checked off i want it to populate text field 2 on page 1.
I'm thinking an if statement might work? I'm a beginner trying to do a job for work. So any help would be appreciated. Could it be fairly detailed due to me being a beginner. Thanks so much
Dave
If you understand field naming using hierarchical field names and how to use an array variable, you could name the check box, text field and place the text in an array that would be tied together by a common value. one could then extract the common value from the check box field and then be able to associate the text in an array element with the same common number to a text field with the same common number. For example the check boxes could be name "CheckBox.#" the text field associated with the check box would be named "Text.#" where "#" is the zero based value of the repeated field and you text would be placed into a zero based array where the "0" element value would be associated with he field "CheckBox.0" to be placed in the "Text.0" field. The script for the "Mouse Up" action for each check box could be:
var sField = event.target.name; // get the name of the check box
var aField = sField.split("."); // create an array of the field name splitting at the "."
var nField = aField[aField.length - 1]; // get the last element of the field's name
this.getField("Text." + nField).value = ""; // by default clear the field associated with the check box
// if field is checked
if (this.getField(event.target.name).value != "Off") {
this.getField("Text." + nField).value = aText[nField]; // get text associated with the check box field
You would need to initialize an array as document level variable with:
aText = new Array("Text for field 0",
"text for field 1",
"text for field 2",
"text for field n");
George Kaiser