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

Javascript to make a drop down filed choose default values

New Here ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

I have 4 dropdown fields C1, F1, F2, F3 , the very first field i.e C1 I intend to make as the the controlling field, such that when I choose say :

if string value  not = to "A" in C1 then F1 becomes readonly and also reset to its default values

if string value not= "B" in C1 then F2 becomes readonly and also reset to its default values

if string value not= "C" in C1 then F3 becomes readonly and also reset to its default values

 

 

 

TOPICS
JavaScript

Views

209

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 , May 17, 2022 May 17, 2022

The basic code to do it (as the custom Validation script of C1) is this:

 

if (event.value!="A") {this.getField("F1").readonly = true; this.resetForm(["F1"]);}

else {this.getField("F1").readonly = false;}

 

You can duplicate and adjust this block of code for the other fields.

Votes

Translate

Translate
Community Expert ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

LATEST

The basic code to do it (as the custom Validation script of C1) is this:

 

if (event.value!="A") {this.getField("F1").readonly = true; this.resetForm(["F1"]);}

else {this.getField("F1").readonly = false;}

 

You can duplicate and adjust this block of code for the other fields.

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