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.


Checkbox is checked when other checkbox is checked +certain value appears on another field

New Here ,
Sep 04, 2021 Sep 04, 2021

Copy link to clipboard

Copied

Hi
you can create a function for which, a Checkbox is checked when other checkbox is checked and at the same time a certain value appears on another field?

TOPICS
JavaScript

Views

49

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 ,
Sep 04, 2021 Sep 04, 2021

Copy link to clipboard

Copied

Should the value of these fields be determined only be the check-box, or should the user be able to manually edit them?

And should they clear when the check-box is unticked?

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
New Here ,
Sep 04, 2021 Sep 04, 2021

Copy link to clipboard

Copied

the value of these fields be determined only be the check-box

And they should be cleared when the checkbox is unchecked

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 ,
Sep 04, 2021 Sep 04, 2021

Copy link to clipboard

Copied

Then you can use the custom calculation script of the text field to do it.

For example, if the check-boxes are called Checkbox1 and Checkbox2 the code would be something like this:

 

this.getField("Checkbox2").checkThisBox(0, this.getField("Checkbox1").valueAsString!="Off")
event.value = this.getField("Checkbox1").valueAsString!="Off" ? "Some text" : "";

 

 

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
New Here ,
Sep 05, 2021 Sep 05, 2021

Copy link to clipboard

Copied

Hi
thank you very much for your help. Your work is perfect.
I phrased the question wrong. I give an example. suppose my checkbox is "Checkbox1".
If I flag "Checkboxe1" and the word "ACDC" appears in the "TextField1" field, the second checkbox called "Checkbox2" is automatically selected. If "Checkbox1" is not checked, "CheckBox2" is also not checked. If the word "ACDC" does not appear in the "TextField1" field, the "CheckBox2" is not selected (= "OFF").
It is this type of function that I am looking for

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
New Here ,
Sep 13, 2021 Sep 13, 2021

Copy link to clipboard

Copied

LATEST

Many thanks for the help. Problem solved

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