Skip to main content
Participating Frequently
May 18, 2022
Answered

Javascript to make a drop down filed choose default values

  • May 18, 2022
  • 1 reply
  • 450 views

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

 

 

 

This topic has been closed for replies.
Correct answer try67

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.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 18, 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.