Save Button Function for Individual tabs in a Dropdown Menu

shiny

#1

My issue that the Save Draft and Publish button doesn’t function correctly switching from different lists on a dropdown.

How would I be able to create a function to save individual pages and not all at the same time.

I’ve tried using “ignoreInit = TRUE, once = TRUE” and it somewhat fixed the issue, but not entirely.

#UI CODE#
  tabPanel("Forecasts Comparisons",
                      sidebarLayout(
                        sidebarPanel(
                          imageOutput("logo",height="70px",width="200px"),

                          hr(),
                          uiOutput("MPDDSelector"),
                          br(),
                          uiOutput("dropDown"),
                          textOutput("TextInfo"),
                          hr(),

 ### Submit Button Code ###


                        mainPanel(
                          tags$head(tags$script(src = "message-handler.js")),
                          fluidRow(splitLayout(cellWidths = c("20%", "20%", "60%"), 
                                               actionButton("Updates", label = actionLabel), 
                                               actionButton("Publishes", label = publishLabel),
                                               checkboxInput("PubConfirm", "Check box to confirm and ACTIVATE Publish Button", FALSE))),
# Server Side # 
MacroQueryList <- c('wire_center','adi','adig','ade', 'aic', 
                            'ase', "avpn_dom", "avpn_mow", 
                            "business_starts", "bvoip", "cdn", "cloud", "packet", "housing_units", "telco_iof_bw",
                            "telco_iof_ports", "ip_comm_subs", "lns_carrier_bw", "lns_carrier_port", "mobility",
                            "mobility_core_subs", "onnet", "netbond",
                            "dom_oew", "pnt", "sdwan_us", "sdwan_mow", "layer_1", "ip_broadband")   

        ddIndex <- as.numeric(input$MPDDSelector)     



        # Draft button # 
        observeEvent(input$Updates, {
          sbt <-str_sub(input$editor1 , start =132L, end =-500L) 
          mpt <- str_sub(input$editor2 , start =132L, end =-500L) 
          RName <- MacroQueryList[ddIndex]   
          SQLTime <- PushFlashDraft(attuid, RName, sbt, mpt)
          output$submit <- renderText(paste0("DRAFT Update Successful at ", SQLTime))
        },  ignoreInit = TRUE, once = TRUE )

        # Publish button  # 
        observeEvent(input$Publishes, {
          RName <- MacroQueryList[ddIndex]
          if (input$PubConfirm == TRUE) {
            SQLTime <- FlashPublish(RName, attuid)
            output$submit <- renderText(paste0("PUBLISH Successful at ", SQLTime)) 
          } else {
            output$submit <- renderText("PUBLISH NOT CONFIRMED. Check the box above to confirm publishing data.")
          }
        })