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

Javascript needed to checkbox in PDF based on value in another field

New Here ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Hi,

My team has a document that we use to determine whether to launch a project or not based off of a point value system based on several criterias. There is a Total Score that is calculated with a value is sum(+) function and a Overall Rating that is calculated with a value is the average function. At the end of the document are two check boxes to either launch or not to launch the project. We would like these checkboxes to trigger based on the Overall Rating criteria. 

  • GO=requires 2 points and higher
  • NO GO= anything under 2 points

 

I am not well versed in javascript so I was hoping someone could get us pointed in the right direction. If anymore information is needed, please me know and ill provide what I can.

 

Thank you in advance!

TOPICS
JavaScript , PDF forms

Views

531

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

correct answers 1 Correct answer

Community Expert , Nov 28, 2022 Nov 28, 2022

If your checkboxes are named "GO" and "NO GO" you can use this as 'Validation' script of "Overall rating" field:

this.getField("GO").checkThisBox(0,Number(event.value)>= 2 ? true : false);
this.getField("NO GO").checkThisBox(0,Number(event.value) != 0 && Number(event.value) < 2 ? true : false);

Votes

Translate

Translate
Community Expert ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

Yous just need the chexkboxes to get ticked automatically based off of a total value that executes  in the sum field, correct?

 

What role is the field that calculates theAverage total field playing in relation to the checbox objects or the sum field?

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 ,
Nov 28, 2022 Nov 28, 2022

Copy link to clipboard

Copied

If your checkboxes are named "GO" and "NO GO" you can use this as 'Validation' script of "Overall rating" field:

this.getField("GO").checkThisBox(0,Number(event.value)>= 2 ? true : false);
this.getField("NO GO").checkThisBox(0,Number(event.value) != 0 && Number(event.value) < 2 ? true : false);

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 ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

LATEST

Wow, this did exactly what we wanted. I sincerly appreciate your help Nesa!

 

Best Regards!

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