How would I use a trigger to enable an input when a certain value in a drop down is selected?
when opt2 is selected in the dropdown I want to enable the input field. I added this trigger but cant get the input to enable, here is the trigger on the dropdown:
Would appreciate some insight if anyone else has done this?
Hi, welcome to the forum
Couple of things to consider here:
First - the event you're triggering on is the "Input Value Change" which fires when the user types into the Select/Dropdown component - ie trying to search for a value or enter free text
You may be looking to trigger this on the change event - ie when a valid option has been chosen
Second - double check what the value of the selected item in the Dropdown is, ie value not label
Hi There, Thanks.
I actually tried your suggestion when continuing to look at this last night - this got the enabling of the input working when the appropriate option was selected. however I had to add a second trigger for the reverse - ie. if a different option was selected to disable the field again - would this be expected?
This means that if you want to control the state of 5 input fields you would have 10 triggers - 2 to control each - seems like a lot of overhead? is there a simpler solution?
My suggestion would be to add the logic to the enabled property of the text input component - have it set to enabled === true only when the correct option has been chosen in the select
It's easir (imo) to see where the disabled/enabled logic is happening when it's attached directly to component rather than have to work out which of the other components is controlling it.