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

How to set up a checkbox to activate when a number less than a certain value is entered

Contributor ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

I am creating a form that will post the results for certain test results on a building. Users will insert particular numbers (e.g., concentration of certain gases, etc.). If number meets acceptable standards (e.g., below acceptable maximum), then I would like a check box to turn on that says the building meets the safety standards. 

 

let A = air quality value

let B = maximum accepted value

let C = checkbox indicating pass

 

So, if A < B, then C is ON (pass); if A > B, C is OFF (fail)

 

TOPICS
How to , JavaScript , PDF forms

Views

694

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 ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

You can use the calculation event of a (hidden) text field to do it.

For example:

this.getField("C").checkThisBox(0, Number(this.getField("A").valueAsString)<Number(this.getField("B").valueAsString));

 

Please be very careful, though, as many PDF viewers will not execute this code and you could get false results, which in this case can even be dangerous!

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
Contributor ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

Thanks for the input. Not sure I want to use a solution that isn't 100% reliable, though, since this form will be out "in the wild" where I can't control who's using it or where it's being distributed.

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 ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

LATEST

Then I recommend you don't use any automatic calculations. Let the users fill in everything themselves and be responsible for the outcome.

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