Skip to main content
Participant
February 27, 2024
Answered

dropdown value

  • February 27, 2024
  • 1 reply
  • 1589 views

I have dropdownA include 1~5, if you choose 1 from dropdown, i want entryfield1 to grayoout.
If i choose 2 from dropdown, I want entryfield2 to grayout.
How I can get with javascript? 

This topic has been closed for replies.
Correct answer Nesa Nurani

By greyout you want to set it to readonly?

As custom calculation script of that dropdown, use this:

this.getField("entryfield1").readonly = event.value == 1 ? true : false;
this.getField("entryfield2").readonly = event.value == 2 ? true : false;

1 reply

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
February 27, 2024

By greyout you want to set it to readonly?

As custom calculation script of that dropdown, use this:

this.getField("entryfield1").readonly = event.value == 1 ? true : false;
this.getField("entryfield2").readonly = event.value == 2 ? true : false;

Participant
February 27, 2024

Thank you, Nesa!

I want to set it to read-only.
Could you also tell me for following case?
If you choose no3, set read-only for entryfield1 and entryfield2.

Nesa Nurani
Community Expert
Community Expert
February 28, 2024

Use this:

var e1 = this.getField("entryfield1");
var e2 = this.getField("entryfield2");

e1.readonly = event.value == 1 || event.value == 3;
e2.readonly = event.value == 2 || event.value == 3;