Lets say I have an Interface with 2 Dropdowns. Lets call them Dropdown1 and Dropdown2. Both have Values Yes and No.
If User selects Dropdown1 with Value Yes, then Dropdown2 should automatically be set to No and it should be greyed out or disabled so that User cannot change it to Yes.
Please advise how we can accomplish this.
Regards,
Mahesh
Discussion posts and replies are publicly visible
HI maheshg821223 ,
There are many different ways to achieve the expected result. I hope this snippet provides you with some ideas.
a!localVariables( local!values: { true(), false() }, local!labels: { "Yes", "No" }, local!dropd1: null(), local!dropd2: null(), a!columnsLayout( columns: { a!columnLayout( contents: a!dropdownField( label: "Dropdown 1", choiceLabels: local!labels, choiceValues: local!values, placeholder: "Select a value", value: local!dropd1, saveInto: { local!dropd1, a!save( local!dropd2, a!match( value: local!dropd1, whenTrue: fv!value, then: false(), default: null() ) ) } ) ), a!columnLayout( contents: a!dropdownField( disabled: and(local!dropd1, not(local!dropd2)), label: "Dropdown 2", choiceLabels: local!labels, choiceValues: local!values, placeholder: "Select a value", value: local!dropd2, saveInto: { local!dropd2 } ) ) } ) )
Acacio B.
An example
a!localVariables( local!drop1: { "Yes", "No" }, local!drop2: { "Yes", "No" }, local!save, local!save2, { a!dropdownField( placeholder: "please select", choiceLabels: local!drop1, choiceValues: local!drop1, value: local!save, saveInto: local!save ), a!dropdownField( placeholder: "please select", choiceLabels: local!drop2, choiceValues: local!drop2, value: if(local!save = "yes", "No", ""), saveInto: a!save(local!save2, save!value), disabled: if(local!save = "yes", true, false) ) } )
Hi maheshg821223 ,
a!localVariables( local!choice: { "Yes", "No" }, local!value1, local!value2: null(), a!columnsLayout( columns: { a!columnLayout( contents: a!dropdownField( label: "Dropdown 1", choiceLabels: local!choice, choiceValues: local!choice, placeholder: "Select a value", value: local!value1, saveInto: { local!value1, } ) ), a!columnLayout( contents: a!dropdownField( label: "Dropdown 2", choiceLabels: local!choice, choiceValues: local!choice, placeholder: "Select a value", value: if( local!value1 = "Yes", a!defaultValue(value: local!value2, default: "No"), local!value2 ), saveInto: { local!value2 }, disabled: local!value1 = "Yes" ) ) } ) )
Thank you Acacio Barrado , your solution worked. Appreciate your help here.
Thank you Prasanta Paul , appreciate the help here.