These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

tally of values from array of pulldowns

Gheezer
Registered: Feb 16 2009
Posts: 19
Answered

I'm new to Acrobat and to scripting, but I catch on quick.

I have 8 text fields for adding points (0, 2 threw 5) and 5 text fields that will hold the number of times each number is used. My thinking was that every time a user inputs a value in a text field, this function would kick off and populate the 5 text fields. What it does is populate all 8 of the text fields with the same number.

I'm not sure if this script is correct. I'd like some help with placement and code.

Thanks.

My scripting so far:
function TALLY_FIELDS()
{
//INPUT TEXT FIELDS
var STANDARDS_ARRAY=new Array(this.getField("b12c96nfFunction_Rating")
, this.getField("b12c96nfGoals_Rating_1")
, this.getField("b12c96nfGoals_Rating_2")
, this.getField("b12c96nfGoals_Rating_3")
, this.getField("b12c96nfGoals_Rating_4")
, this.getField("b12c96nfGoals_Rating_5")
, this.getField("b12c96nfBehavior_Rating_1")
, this.getField("b12c96nfBehavior_Rating_2"));

//TALLY TEXT FIELDS
var OBJECTIVE_ARRAY=new Array(this.getField("b12c96nfFar_Exceeding_Qty")
, this.getField("b12c96nfExceeding_Qty")
, this.getField("b12c96nfMeeting_Qty")
, this.getField("b12c96nfMeeting_Some_Qty")
, this.getField("b12c96nfNot_Meeting_Qty"));

//RESET TALLY TEXT FIELDS
this.resetForm(OBJECTIVE_ARRAY);

for (i=0;i

My Product Information:
Acrobat Pro 8.1.1, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
You probably meant to do this:

for (i=0;i<STANDARDS_ARRAY.length;i++) {if (STANDARDS_ARRAY[i].value=="5"){this.getField('b12c96nfFar_Exceeding_Qty').value = this.getField('b12c96nfFar_Exceeding_Qty').value + 1}else if (STANDARDS_ARRAY[i].value=="4"){this.getField('b12c96nfExceeding_Qty').value = this.getField('b12c96nfExceeding_Qty').value + 1}else if (STANDARDS_ARRAY[i].value=="3"){this.getField('b12c96nfMeeting_Qty').value = this.getField('b12c96nfMeeting_Qty').value + 1}else if (STANDARDS_ARRAY[i].value=="2"){this.getField('b12c96nfMeeting_Some_Qty').value = this.getField('b12c96nfMeeting_Some_Qty').value + 1}else{this.getField('b12c96nfNot_Meeting_Qty').value = this.getField('b12c96nfNot_Meeting_Qty').value + 1} }

In other words, you loop was not set up correctly.

George
Gheezer
Registered: Feb 16 2009
Posts: 19
Yes!! That is what I meant to do... DOH!

Thanks for pointing out my error. I'm still learning.

Troy