How can I require that a user selects an input from a pickerInput?
Here is a basic example:
library("shiny")
library("shinyWidgets")
ui <- fluidPage(
column(
width = 4,
pickerInput(inputId = "fruit",
label = "Fruits",
choices = c("Apple", "Mango", "Pear", "Orange"),
options = list(`actions-box` = T,
`none-selected-text` = "Please make a selection!"),
multiple = T)
))
server <- function(input, output) {
output$res <- renderPrint({
input$fruit
})
}
shinyApp(ui = ui, server = server)
Is there an option I can add when I create the pickerInput menu that sets it so that the menu will always require input?
req(input$fruit)might help as the first line insideoutput$res.selected=inside thepickerInputthat way it initializes on a choice, therefore no choice is not an option?