Hi,
The best method to dynamically change input is to use the updateSelectInput function on the server side. Combine this with an observeEvent for the selectInput, and you will be able to fix this. Let me try give an example:
Example app
library(shiny)
ui <- fluidPage(
#Keep the choices blank, or set the default values
selectInput("input1", "Input 1", choices = ""),
selectInput("input2", "Input 2", choices = "")
)
server <- function(input, output, session) {
#Will only be run once when initialized, because not in observe event
#Good thing this way is you can set the choices based on any variable
updateSelectInput(session, "input1", choices = c("choice1", "choice2"))
#Now change option 2 based on option 1
observeEvent(input$input1, {
#Here filter any existing data based on the input1 to get the options for input2
myChoices = paste(input$input1, "_option_", 1:5, sep = "") #replace with your code
#Update the input 2
updateSelectInput(session, "input2", choices = myChoices)
})
}
shinyApp(ui = ui, server = server)
Hope this helps!