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

Check box of group enables second check box issue

Explorer ,
Jun 24, 2021 Jun 24, 2021

Copy link to clipboard

Copied

I've created one group of checkboxes (Type of Parking) and a second checkbox (Car Pool) Car Pool is only enabled when "Regular Access" from Type of Parking is checked. When anything else in the Type of Parking Group is checked or nothing is checked Car Pool should be blank and read-only.

 

I've applied the following script to each checkbox in the Type of Parking group:

if (event.target.valueAsString == "Regular Access") {

this.getField("Car Pool").readonly = false;

} else {

this.getField("Car Pool").readonly = true;

}

and the following script to the Car Pool checkbox

this.getField("Car Pool").readonly = true;
this.resetForm(["Car Pool"]);

It seems to work as far as making Car Pool Read Only or not but I am unable to actually check the Car Pool checkbox when it's enabled. Can anyone help me out here, please?

Here is the link to my sample:

https://drive.google.com/file/d/1BxMhMx7Mr9jEkcDKDa2opbsVFJm3xClO/view?usp=sharing

TOPICS
JavaScript , PDF forms

Views

461

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

Hi,
Here is the script for each checkbox of the Type of Parking group:

if (event.target.value == "Regular Access") this.getField("Car Pool").readonly = false;
else {
	this.getField("Car Pool").value = "Off";
	this.getField("Car Pool").readonly = true;
}

And remove the one of the Car Pool checkbox!
@+

Votes

Translate

Translate
Community Expert ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

Hi,
Here is the script for each checkbox of the Type of Parking group:

if (event.target.value == "Regular Access") this.getField("Car Pool").readonly = false;
else {
	this.getField("Car Pool").value = "Off";
	this.getField("Car Pool").readonly = true;
}

And remove the one of the Car Pool checkbox!
@+

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
Explorer ,
Jun 25, 2021 Jun 25, 2021

Copy link to clipboard

Copied

LATEST

Thank you very much! I deleted my Car Pool Checkbox and remade it then it worked perfectly with this script.

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