• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JavaScript help - Value of text out of 60 represents 50% of final score

New Here ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

Hello I am trying to update a document with a Javascript in which, you can calculate the following:

 

Box 1) "Total score out of 60" give a value of 50% of "final score"

Box 2) "total score out of 15" give a value of 50% of "final score"

 

Final score = Box 1+ Box 2 - I can do the simple additions ... don't need help here.

 

 

TOPICS
JavaScript , PDF forms

Views

94

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
community guidelines
Community Expert ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

Enter the following custom calculation script in the result field:

event.value = this.getField("Box1").value/60 * 37.5 + this.getField("Box2").value/15 * 37.5;

Change Box1 and Box2 to the actual field names.

Votes

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
community guidelines
New Here ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

it didn't work.

 

"Total_Comp" is score out of 60

"Total_Goals" is a score out of 15

 

I need 2 scripts ("fifty_comp" & "fifty_goals") to calculate each value as a score out 50

then I will add other box to combine sum of "fifty_comp" & "fifty_goals". - no need for help on this one. 

Votes

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
community guidelines
Community Expert ,
Aug 16, 2024 Aug 16, 2024

Copy link to clipboard

Copied

LATEST

Change both 37.5's to 50, and split the script into 2 parts where the + sign is.  I don't know the names of your fields.  The first script would be:

event.value = this.getField("Box1").value/60 * 50;

the 2nd script would be

event.value = this.getField("Box2").value/15 * 50;

Votes

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
community guidelines