reset checkbox group with action button

i have a checkbox group in my shiny dashboard body

checkboxGroupInput("dbr", selected = NULL,
                                                      h4("Select a box"),
                                                      c(
                                                          "Low" = "Low",
                                                          "Medium" = "Medium",
                                                          "High" = "High",
                                                          "Critical" = "Critical"
                                                      # End check list 
                                                      ), 
                                                      # End check group
                                                      
                                   ),

i also have an action button that I'm using as a reset button for checkbox items on the page

actionButton("reset_artifact_entry", label = "Reset")

in the server section of the code i have a call for reset

server <- function(input, output, session)

    # Rest button for artifact entry page
    observeEvent(input$reset_artifact_entry, {
        updateCheckboxGroupInput(session, "dbr", selected = NULL)
        
    })

i don't get any errors when the code runs, but nothing happens when i click the button either -
I've looked all over stackoverflow and wherever i could to find the solution to this...
I'm sure its in the way i have it set up but i can't seem to find where

cheers ~!

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

@nirgrahamuk

yep - let me look through that guide and get to it...

thanks =)

@nirgrahamuk

done -

 ``` r
#
    # This is a Shiny web application. You can run the application by clicking
    # the 'Run App' button above.
    #
    # Find out more about building applications with Shiny here:
    #
    #    http://shiny.rstudio.com/
    #
    
    # Libraries to load
    
    library(shiny)
    library(shinydashboard)
#> 
#> Attaching package: 'shinydashboard'
#> The following object is masked from 'package:graphics':
#> 
#>     box
    library(googlesheets4)
    library(markdown)
    library(DT)
#> 
#> Attaching package: 'DT'
#> The following objects are masked from 'package:shiny':
#> 
#>     dataTableOutput, renderDataTable
    library(ggplot2)
    library(plotly)
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
    library(rmarkdown)
    library(knitr)
    library(pander)
#> 
#> Attaching package: 'pander'
#> The following object is masked from 'package:shiny':
#> 
#>     p
    
    
    # Beginning of Dashboard
    
    ui <- dashboardPage(
        
        # Begin dashboard header
        dashboardHeader(title = "Dashboard"),
        
        # Dashboard Sidebar
        
        dashboardSidebar(
            
            # Begin sidebar menu
            sidebarMenu(
                menuItem("Artifact Entry", tabName = "artifactentry")
                # End sidebar menu 
            )
            # End dashboard sidebar menu
        ),
        
        # Dashboard Body
        
        dashboardBody 
        
        # Begin dashboard body
        (
            # Being tab items when clicking sidebar menu items
            tabItems
            
            (
                
                # Begin second tabItems - Artifact Entry
                tabItem(tabName = "artifactentry", h2("Artifact Entry"),
                        
                        # Begin first fluid row - submit or reset
                        fluidRow(
                            
                            # Begin first box of first row - Submit and Reset Buttons
                            box(h3("Submit or Reset Data"), width = 7,
                                
                                # Begin first column - Submit
                                column(3, h4("Submit Data"),
                                       actionButton("action", label = "Submit")         
                                ),
                                # Begin second column - Reset
                                column(3, h4("Reset Entries"),
                                       actionButton("reset_artifact_entry", label = "Reset")
                                )
                                # End first box - submit and reset buttons
                            )
                            
                            # End first fluid row
                        ),
                        
                        # Begin second fluid row
                        fluidRow(
                            
                            # Begin first box of row
                            box(h3("Scores and Rating"), width = 7,
                                column(4, h4("Scores and Rating"),
                                       checkboxGroupInput("dbr", selected = NULL,
                                                          h4("Select Rating"),
                                                          c(
                                                              "Low" = "Low",
                                                              "Medium" = "Medium",
                                                              "High" = "High",
                                                              "Critical" = "Critical"
                                                              # End check list 
                                                          ), 
                                                          
                                                          # End check group                   
                                       )
                                       
                                       # End column       
                                )
                                
                                # End box of first fluid row    
                            )
                            # End fluid row    
                        )
                        # end tab item        
                )
                # End Tab Item - Artifact Entry
            )
            
            # End dashboard body                       
        )
        
        
        # End ui dashboard page  
    )   
    
    
    
    # Call to server
    server <- function(input, output, session) {
        
        
        # Rest button for artifact entry page
        observeEvent(input$reset_artifact_entry, {
            updateCheckboxGroupInput(session, "dbr", selected = NULL)
            
        })
        
        
        
        # End server function
    }
    
    shinyApp(ui, server)
Shiny applications not supported in static R Markdown documents

Created on 2021-02-20 by the reprex package (v1.0.0)


cheers~!

solved here -

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.