I am looking to create a conditional panel in shiny that becomes active if the input that user selects from a list (i.e. selectInput function) belongs to another vector.
I am aware that the condition in the conditional panel is a javascript element, however I cannot make it work.
Can someone help?
Here is the UI part of the code under examination:
legs1 <- c("HOUSE","VILLA","ATTICO")
selectInput("strategy", "Strategy:", choices = df[,6]),
conditionalPanel(
condition = 'input.strategy && input.strategy.indexOf("legs1") > -1',
textInput("Leg1", "Leg1",value = ""),
textInput("Leg2","Leg2", value =""),
),
If you don't have to access the vector from within the condition it should work by using
condition = "input.strategy && ['HOUSE', 'VILLA', 'ATTICO'].indexOf(input.strategy) > -1"