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

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

459

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?

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 ,
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;}

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 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.

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
Enthusiast ,
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?

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

Copy link to clipboard

Copied

LATEST

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. 

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