Author

ui <- fluidPage( checkboxGroupInput( “checks”, “Check boxes”, choices = month.name, selected = month.name[1] ), actionButton(“search”, “Search”), uiOutput(“ui_stuff”) )

server <- function(input, output, session) { reactive_checkboxes <- reactiveValues(checks = c())

observeEvent(input$checks, { print(“change”)

reactive_checkboxes$checks <- input$checks

})

observeEvent(inputsearch, { if (is.null(inputchecks)) { showModal(modalDialog( title = “Invalid search conditions!”, div(p(“You must select at least one theme to filter the data.”), p(“Click dismiss and your previously selected set of themes will be re-selected.”) )))

  updateCheckboxGroupInput(session,
                           "checks",
                           selected = reactive_checkboxes$checks)
  
}

})

output$ui_stuff <- renderUI({ “dummy element here” }) }

shinyApp(ui, server)

Reuse

Citation

BibTeX citation:
@online{hadley,
  author = {Hadley, Charlie},
  url = {https://visibledata.co.uk/posts/2024-02-27_empty-checkboxes/null checkboxgroup check.html},
  langid = {en}
}
For attribution, please cite this work as:
Hadley, Charlie. n.d. https://visibledata.co.uk/posts/2024-02-27_empty-checkboxes/null checkboxgroup check.html.