Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


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

Participant ,
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

287

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
community guidelines
Adobe Community Professional ,
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!

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
community guidelines
Participant ,
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.

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
community guidelines
Adobe Community Professional ,
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.

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