I have a R Shiny app with many inputs, and before it runs the output, I want to avoid it showing the output until it has all required inputs. However, there are many outputs, and rather than type them all out, I'd like to use the req() call by their div tag (inputs).
Here's a simple app:
library(shiny)
ui <- fluidRow(
column(12,
div(id = "inputs",
selectInput(inputId = "reasons",
label = "Select Your Reasons",
choices = c("Everything", "Your Hair", "Your Eyes", "Your Smile"),
multiple = TRUE),
selectInput(inputId = "verb",
label = "Select Your Verb",
choices = c("love", "hate"),
multiple = TRUE)),
textOutput("message")
)
)
server <- function(input, output) {
output$message <- renderText({
paste("I", input$verb, input$reasons)
})
}
shinyApp(ui = ui, server = server)
I trieded adding shiny::req(input$inputs)
in between the renderText
and paste
calls, but that code made nothing show up, even when I selected values for the 2 dropdowns.