Highlighted

Marine Toys for Tots Family App design help

New Here ,
Oct 13, 2020

Copy link to clipboard

Copied

Hi everyone, I am in the Marine Corps and am in charge of Toys for Tots this year.  I need assistance with make a Toys for Tots family application fillable form using Adobe Acrobat Pro 2017.  I am very new to Adobe JavaScripts and a "Boot" at software codes period!  I want to make it user friendly for the public to use.  If some one can help me, you'll actually be help +200k potential families.  I am looking to calculate totals with set conditions from 10 dropdown boxes labeled "Gender1 - 10") with  "Boy" or "Girl" option, and 10 text field boxes labeled "Age" with 0 - 14 years old (Vague illustration below):

 

Gender1:  Boy   Age1:  2

Gender2:  Boy   Age2:  4
Gender3:  Girl   Age3:  8


Totals:

Ages|      0 - 4        5 - 9         10 - 14

Boys:        2              0                0

Girls:        0              1                0

 

RithM
TOPICS
Comment review and collaborate PDF, Create PDFs, Edit and convert PDFs, PDF forms

Views

61

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Marine Toys for Tots Family App design help

New Here ,
Oct 13, 2020

Copy link to clipboard

Copied

Hi everyone, I am in the Marine Corps and am in charge of Toys for Tots this year.  I need assistance with make a Toys for Tots family application fillable form using Adobe Acrobat Pro 2017.  I am very new to Adobe JavaScripts and a "Boot" at software codes period!  I want to make it user friendly for the public to use.  If some one can help me, you'll actually be help +200k potential families.  I am looking to calculate totals with set conditions from 10 dropdown boxes labeled "Gender1 - 10") with  "Boy" or "Girl" option, and 10 text field boxes labeled "Age" with 0 - 14 years old (Vague illustration below):

 

Gender1:  Boy   Age1:  2

Gender2:  Boy   Age2:  4
Gender3:  Girl   Age3:  8


Totals:

Ages|      0 - 4        5 - 9         10 - 14

Boys:        2              0                0

Girls:        0              1                0

 

RithM
TOPICS
Comment review and collaborate PDF, Create PDFs, Edit and convert PDFs, PDF forms

Views

62

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 13, 2020 0
Most Valuable Participant ,
Oct 13, 2020

Copy link to clipboard

Copied

What are the names of the Total fields?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 13, 2020 0
Most Valuable Participant ,
Oct 13, 2020

Copy link to clipboard

Copied

Let's say they are called BoysTotal1, BoysTotal2, BoysTotal1, and the same for girls (GirlsTotal1, etc.).

You can then use this code as the custom calculation script of one of those fields (such as BoysTotal1, for example):

 

var boys = [0, 0, 0];
var girls = [0, 0, 0];

for (var i=1; i<=3; i++) {
	var gender = this.getField("Gender"+i).valueAsString;
	var age = this.getField("Age"+i).valueAsString;
	if (gender=="" || age=="") continue;
	age = Number(age);
	if (gender=="Boy") {
		if (age<=4) boys[0]++;
		else if (age<=9) boys[1]++;
		else if (age<=14) boys[2]++;
	} else if (gender=="Girl") {
		if (age<=4) girls[0]++;
		else if (age<=9) girls[1]++;
		else if (age<=14) girls[2]++;
	}	
}
for (var i=0; i<boys.length; i++) {
	this.getField("BoysTotal"+(i+1)).value = boys[i];
}
for (var i=0; i<girls.length; i++) {
	this.getField("GirlsTotal"+(i+1)).value = girls[i];
}

 

Edit: Small mistake fixed in the code

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 13, 2020 0
New Here ,
Oct 13, 2020

Copy link to clipboard

Copied

Ok.  I'll try it out and let you know.  Thank you for the support thus far?

RithM

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 13, 2020 0
Most Valuable Participant ,
Oct 13, 2020

Copy link to clipboard

Copied

You're welcome?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 13, 2020 0
RWM82 LATEST
New Here ,
Oct 13, 2020

Copy link to clipboard

Copied

Sorry I meant for ! Instead of ? 😂 

RithM

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 13, 2020 0