lundi 19 août 2019

How to use observeEvent with a checkbox event Shiny

How do I trigger an action (in this case updateSelectInput) with observeEvent based on a TRUE/FALSE checkbox event?

For example I would like to update result when test is TRUE:

library(shiny)
ui<-fluidPage(
  checkboxInput("test","Test",value=FALSE),
  selectInput("result","Result",choices=c("1","2","3"),selected="1")
)

server<-function(input, output){
  observeEvent(input$test{
    updateSelectInput(session,"result",choices=c("1","2","3","4","5"),selected="1")
  })
}


shinyApp(ui=ui,server=server)




Aucun commentaire:

Enregistrer un commentaire