Highlighted

Scoring Card for audit

Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

Hello all, 

 

I am working on a scoring audit form in Adobe PDF that will contain dropdown boxes with options compliant, needs attention, urgent. Once all 50 items are inspected I need a total percentage score for all 50 sections that were inspected. However I am new to Javascript and cannot get it to work for me. Can someone please help me with the script. Thank you. 

TOPICS
Edit and convert PDFs, How to, PDF forms

Views

67

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

Scoring Card for audit

Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

Hello all, 

 

I am working on a scoring audit form in Adobe PDF that will contain dropdown boxes with options compliant, needs attention, urgent. Once all 50 items are inspected I need a total percentage score for all 50 sections that were inspected. However I am new to Javascript and cannot get it to work for me. Can someone please help me with the script. Thank you. 

TOPICS
Edit and convert PDFs, How to, PDF forms

Views

68

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
Jul 30, 2020 0
Most Valuable Participant ,
Jul 30, 2020

Copy link to clipboard

Copied

What are the names of the fields? Which values do you want to count, exactly?

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...
Jul 30, 2020 0
Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

The fields are named dropdown1 to dropdown50, each dropdown has a blank entry, Compliant, Needs Attention, Urgent. Once all 50 are completed only the urgent marked dropdowns will affect the 100% passing score.  Also if a dropdown is selected as urgent I need the name of that box to tranfer to a failed text box in another section. thank you. 

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...
Jul 30, 2020 0
Most Valuable Participant ,
Jul 30, 2020

Copy link to clipboard

Copied

So you want to count the drop-downs that are marked as "Urgent" and calculate their percentage out of 50?

What's are the names of the text fields that correspond to those drop-downs?

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...
Jul 30, 2020 0
Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

Only one box Inspection Score. Thank you

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...
Jul 30, 2020 0
Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

Im sorry i think i misunderstood your last question the dropdowns were left as dropdown 1 thru dropdown 50 and the total score out of 100 should populate into box named Inspection score. 

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...
Jul 30, 2020 0
Most Valuable Participant ,
Jul 30, 2020

Copy link to clipboard

Copied

You wrote: Also if a dropdown is selected as urgent I need the name of that box to tranfer to a failed text box in another section.

By "name of that box" do you mean "dropdown1", "dropdown14", "dropdown22", etc.?

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...
Jul 30, 2020 0
Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

yes 

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...
Jul 30, 2020 0
Most Valuable Participant ,
Jul 30, 2020

Copy link to clipboard

Copied

You can use this code as the custom calculation script of the score field, and it will also populate a field called "Urgents" with the names of the drop-downs:

 

var urgentFields = [];
for (var i=1; i<=50; i++) {
	var fname = "dropdown"+i;
	var f = this.getField(fname);
	if (f==null) {
		app.alert("Error! Could not find the field: " + fname);
		return;
	}
	if (f.valueAsString=="urgent") urgentFields.push(fname);
}
if (urgentFields.length==0) event.value = "";
else event.value = urgentFields.length/50;
this.getField("Urgents").value = urgentFields.join(", ");

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...
Jul 30, 2020 0
Community Beginner ,
Jul 30, 2020

Copy link to clipboard

Copied

its not working its stating that Syntax Error: return not in function 7: at line 8

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...
Jul 30, 2020 0
try67 LATEST
Most Valuable Participant ,
Jul 31, 2020

Copy link to clipboard

Copied

Sorry about that. Just remove the "return;" line.

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...
Jul 31, 2020 1