Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Need multiple checkboxes to autofill their values into a separate textbox as they are checked

Avatar

Level 1

Hi,

I have a form that requires the user to check a box regarding what articles they want mailed out to a participant depending on which client they are affiliated with and the language they speak. I am using 1 form for 7 clients. There is a separate page for each client in english and spanish, so the entire form has 16 pages with 2,988 checkboxes in the entire document (a little over 200 in each page besides the first and last page). The last page contains a textbox labled Summary, and it should provide a summary of all the items checked in the document. The first page contains a dropdown menu of each client and a radio button set with the language selection. Theoretically only one page will be populated at a time, so there will be no more than 200 checkboxes checked in the entire document.

As the articles are checked I want the checkbox name to automatically populate into the summary textbox on the last page. The code I'm using is below, but I can't get it to work.

I don't get a script error, but there is nothing populating in the summary textbox.

Can someone tell me what I'm doing wrong?

The JS I am trying to get to work is the following:

form1.SummaryPage.SummaryText::calculate - (JavaScript, client)

// Custom Calculate script

(function () {

var i, v, s = "";

// Loop through the 2988 check boxes

for (i = 1; i < 2989; i += 1) {

// Get the value of the current checkbox

  • v = getField("checkbox " + i).valueAsString;

// Concatenate check box value to string if not deselected

if (v !== "Off") s+= v + "\r";

}

// Set this field value

  1. event.value = s;

})();

1 Reply

Avatar

Level 10

Hi,

This looks like code from an AcroForm.  A Designer form does not have a getField method, try something like;

xfa.resolveNode("checkbox"+1).rawValue

And at the end use;

this.rawValue = s;

Code in a calculate event does not seem to report any errors, try testing it in a click event

Regards

Bruce