Copy link to clipboard
Copied
Hi,
I am having 2 Dropdown DP1 and DP2.
the values of DP1 is A,B,C and DP2 value is E,F,G
if i select the 'A' from DP1, in DP2 value shld be 'E' and the remaining values ('F' and 'G') should be greyed out automatically.
if i select the 'B' from DP1, in DP2 value shld be 'F' and the remaining values ('E' and 'G') should be greyed out automatically.
if i select the 'C' from DP1, in DP2 value shld be 'G' and the remaining values ('E' and 'F') should be greyed out automatically.
i know how to make the whole field read only, but here i am asking like the particular value in drop down alone should be read only not a whole drop down.
Could any one please help me on this.
Copy link to clipboard
Copied
You can't set readonly some entries of the dropdown. At validation of the dropdown you can reject selected entries.
Copy link to clipboard
Copied
You can't grey out items in a drop-down. As mentioned, you can use a script to reject certain selections, but a much better option is to change the actual list of available items in the drop-down to just those values that you want the user to select from.
Copy link to clipboard
Copied
Could you please provide the script to reject certain selections of dropdown.
Copy link to clipboard
Copied
As the custom validation script of the drop-down you can use something like this:
if (this.getField("DP1").valueAsString=="A" && (event.value=="F" || event.value=="G")) {
app.alert("The selected value is not allowed.");
event.rc = false;
}
Copy link to clipboard
Copied
Just use caclulation script in "DP2" field
if(this.getField("DP1").valueAsString == "A")
event.value = "D";
use 'else if' to add other combinations.
Even if you try select other values it won't change.
Copy link to clipboard
Copied
Thank you so much, for your help. I will try and let u know.
Copy link to clipboard
Copied
event.value pointing to DP1 aor DP2?
Copy link to clipboard
Copied
It points to DP2 field,
if DP1 value is A DP2 value will be D.
Copy link to clipboard
Copied
You mentioned like "Just use caclulation script in "DP2" field"
Could you pls provide me the script, i m new to this adobe script.
Copy link to clipboard
Copied
I gave you script for A value now just write 'else' (whitout quotes) and paste my script again and just change values form A to B and D to E and repeat again for last combination.
Copy link to clipboard
Copied
var field_dp2=this.getField('dropdown2');
var field_dp2=this.getField('dropdown3');
var fieldScript="switch (event.value) {
case 'A':
field_dp2="E";
field_dp3="H";
break;
case 'B':
field_dp2="F";
field_dp3="I";
break;
case 'C':
field_dp2="G";
field_dp3="J";
break;
}
Will this script work for 3 drop downs?
Copy link to clipboard
Copied
Based on value of dropdown1, dropdown2 and dropdown3 value gets populated.
Copy link to clipboard
Copied
@Asim123 this script will work
Copy link to clipboard
Copied
Got the answer, thanks for your help.