Checkbox enable or disable feature based on another checkbox selection

Community Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

Hi,

I have 4 checkbox, if i select check box 2, the checkbox 1A and checkbox 1B is automatically unselect or may be not editable and if i unselect the check box 2, the checkbox 1A and checkbox 1B should be available for editing. Could anyone pls provide script for this.

 

Ridhi5EA5_0-1614276491332.png

 

Views

53

Likes

translate

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 Beginner ,
Feb 25, 2021 Feb 25, 2021

Copy link to clipboard

Copied

var CheckBoxVal = this.getField("CheckBox 2").value;

var otherfield= "if (event.target.value != "Off") {
this.getField(" this.getField("CheckBox 1A").readonly = true;

this.getField(" this.getField("CheckBox 1A").readonly = true;
} else {
this.getField(" this.getField("CheckBox 1A").readonly = false;

this.getField(" this.getField("CheckBox 1B").readonly = false;
}"

CheckBoxVal.setAction("MouseDown", otherfield);

CheckBoxVal.setAction("MouseUp", otherfield);

 

Will this script work?

Likes

translate

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

Copy link to clipboard

Copied

Use this script as Mouse UP event of "Check Box 2"

if (event.target.value != "Off"){
this.getField("CheckBox 1A").value = "Off";
this.getField("CheckBox 1A").readonly = true;
this.getField("CheckBox 1B").value = "Off";
this.getField("CheckBox 1B").readonly = true;}
else if(event.target.value == "Off"){
this.getField("CheckBox 1A").readonly = false;
this.getField("CheckBox 1B").readonly = false;}

Likes

translate

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 Beginner ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

var CheckBoxVal = this.getField("CheckBox 2");

Getting error for above line as CheckBoxVal is null.

Likes

translate

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
Engaged ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

You already got an answer for your original post, is it not working or you require something else?

What code are you trying to use and where?

Likes

translate

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 Beginner ,
Feb 26, 2021 Feb 26, 2021

Copy link to clipboard

Copied

var CheckBoxVal = this.getField("CheckBox 2");

var otherfield= "if (event.target.value != "Off") {
this.getField(" this.getField("CheckBox 1A").readonly = true;

this.getField(" this.getField("CheckBox 1A").readonly = true;
} else {
this.getField(" this.getField("CheckBox 1A").readonly = false;

this.getField(" this.getField("CheckBox 1B").readonly = false;
}"

CheckBoxVal.setAction("MouseUp", otherfield);

 

i am passing the above code via xml, in this code i'm getting error as CheckBoxVal is null. i dont know why it is null. 

Likes

translate

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