Can I create inter dependent selectInput(s) in Shiny App.


I am trying to make a shiny app which contains two inputs. The question is how can I make them reactive to each other.

I have a table
with parts id & parts name

input1 is choices for parts id
input2 is choices for parts name

I want to do something like this, if I choose from input1(part id), in input2 (part name) is automatically selected.
Or, if I choose from input2(part name), input1 (part id) is selected.

Note:- that both the inputs are reusable. i.e. if selected from input 1, no values of input 2 must get removed. (All values should be present for another selection).

I am trying to do the same

but different errors pops up one of which is:-

Error in $<-.reactivevalues: Attempted to assign value to a read-only reactivevalues object

Any methodology or package I can use for this. :thinking:

Sorry, could not generate a reprex.
Thanking you for your answer :hugs:


You could use an observeEvent for each input. So when a user clicks them, your code will execute. Within those statements, you could then create a updateSelectInput function to update the the other input with the appropriate value. You may need to wrap it in an isolate statement to prevent unwanted double execution.