Can't get my action Button to trigger an action

I'm having some trouble understanding this. This code takes in parameters for a function, should validate the parameters exist, and then try to plot the data read from the file parameter. It should not do any of this until the actionButton Go is pressed. Here is code:
...

Plex dashboard

library(shiny)
library(shinydashboard)
options(shiny.maxRequestSize=30*1024^2)
tz="GMT"

ui <- dashboardPage(

dashboardHeader(title = "Plexogram"),

Sidebar content

dashboardSidebar(
sidebarMenu(
menuItem("Configure", tabName = "config", icon = icon("tachometer-alt"),
menuSubItem("Input parameters", tabName = "inputP", icon = icon("database")),
menuSubItem("View input data", tabName = "inputD", icon = icon("database")),
menuSubItem("View binned data", tabName = "inputB", icon = icon("database"))),

  menuItem("About Plexogram", tabName = "about", icon = icon("info")),
  menuItem("Documentation", tabName = "document", icon = icon("readme"))
)

),

Body content

dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "inputP",
h4("Tabs hold parameters for configuring Plex."),
fluidRow(
tabBox(title = "Plex Parameters", id = "paramBox", height = "250px", width=12, side="right",
tabPanel("File Parameters", value="paramFile1",
p(" "),
p("Select the data file, and basic file characteristics."),
box(fileInput(inputId="fileName", label="Choose CSV or TXT file",
accept = c("text/csv", "text/comma-separated-values,text/plain", ".csv"),
width = "380px", buttonLabel = "Browse...", placeholder = "No file selected"),width=5),
box(radioButtons(inputId="header", label="Header in data file?",
choices=c(TRUE, FALSE),
selected = NULL,inline = FALSE, width = '80px'),width=2),
box(numericInput(inputId="Skip", label="Skip rows before data?", value=0, min = 0, width = '80px'),width=2),
box(textInput(inputId="timeFormat", label="Time format (R syntax)", value = "%d/%m/%Y %H:%M:%S", width = '200px'),width=3) # , placeholder = "%Y%m%d%MM%HH"
), # close tabPanel
tabPanel(title="More File Parameters", value="paramFile2",
p(" "),
p("Select additional file characteristics."),
box(numericInput(inputId="timeCol", label="Column #: Time", value=1, min = 0, width = '80px'),width=2),
box(numericInput(inputId="valCol", label="Column #: data (averagable)", value=8, min = 0, width = '80px'),width=2),
box(numericInput(inputId="sumCol", label="Column #: data (summable)", value=0, min = 0, width = '80px'),width=2),
box(textInput(inputId="title", label="Title this run:", value = "", width = '440px', placeholder = "To distinguish this run from others"),width=6)
), # close tabPanel
tabPanel(title="Binning",value="paramBin",
p(" "),
p("Will you bin the data from the input file before analysis? Set binning parameters."),
box(radioButtons(inputId="bin", label="Bin data?",
choices=c("True" = TRUE,
"False" = FALSE), selected = NULL,inline = FALSE, width = '80px'),width=2),
box(numericInput(inputId="Interval", label="Resulting bin size (hrs)", value=3, min = 0, width = '80px'),width=2),
box(numericInput(inputId="Midpoint", label="Midpoint (hrs past start of bin)", value=.5, min=0,max=1, width = '200px'),width=2),
#box(dateRangeInput(dateRange, "Date range:")
box(textInput(inputId="start", label="Binning start time", value = "25/08/2017 06:00:42", width = '200px', placeholder = "put timeFormat here"),width=3),
box(textInput(inputId="end", label="Binning end time", value = "01/10/2017 23:59:53", width = '200px', placeholder = verbatimTextOutput("input$timeFormat")),width=3)
), # close tabPanel
tabPanel(title="Plex",value="paramPlex",
p(" "),
p("Reference time, number of folds, and number of classes for the plexogram and ANOVA."),
box(actionButton(inputId="Go", label="Run Plex"),width=3),
box(numericInput(inputId="nClasses", label="# of classes in fold:", value=0, min = 0, width = '80px'),width=2),
box(numericInput(inputId="foldLen", label="Length of each fold:", value=.5, min=0,max=1, width = '200px'),width=2),
box(textInput(inputId="RefTime", label="Reference date/time", value = "", width = '200px', placeholder = "put timeFormat here"),width=3)
) # close tabPanel
) # close tabBox
), # close fluidrow
fluidRow(
tabBox(title = "Plots", id = "plotBox", height = "500px", width=12, side="right",
tabPanel(title="Plex-Plots", value="plotPlex",
p(" "),
p("This is a plot of the data folded over into a Plexogram.")
# commented out until plotData works
#box(plotOutput("resultsT"),width=12)
), # close tabPanel
tabPanel(title="Data-Plots", value="plotData",
p(" "),
p("This is a plot of the data file, or binned data, if binning was used."),
box(plotOutput("resultsP"),width=12)

                      )    # close tabPanel
                   )     # close tabBox
          )    #  close fluidrow
  ),
  # Second tab content
  tabItem(tabName = "inputD",
          h3("Data from input file"),
          tableOutput("data")
          
  ),
  # Third tab content
  tabItem(tabName = "inputB",
          h3("Data from input file, after binning"),
          tableOutput("binData")
          
  ),
  # Sixth tab content
  tabItem(tabName = "about",
          h3("About the Plex -- uses and overview")
  ),
  # Seventh tab content
  tabItem(tabName = "document",
          h2("Details of using Plex;  parameter definitions")
  )
  )  #  end of tabItem-s
)  #  end of dashboardBody

) # end if UI

server <- function(input, output) {

pMatrix<-reactive({
# input$data1 will be NULL initially. After the user selects and uploads a file, it will be a data frame with 'name',
# 'size', 'type', and 'datapath' columns. The 'datapath' column will contain the local filenames where the data can
# be found.

    #req(input$fileName)
    validate(need(input$timeFormat, "Error: Please provide the time format in the File Parameters tab."),
             need(input$fileName, "Error: Please provide the file name in the File Parameters tab."),
             need(input$timeCol, "Error: Please provide the time column in the More File Parameters tab."),
             need(input$valCol, "Error: Please provide the data column in the More File Parameters tab."))

    inFile <- input$fileName

    if (is.null(inFile))
      return(NULL)
    pFileRead(header=as.logical(input$header), Skip=input$Skip, TimeCol=input$timeCol, Y=input$valCol, fileName=inFile$datapath,functionName=input$title)

})

output$data <-renderTable({pMatrix()
}, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)

output$binData <- renderTable({bMatrix()
}, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)
  
bMatrix<-reactive({
# input$data1 will be NULL initially. After the user selects and uploads a file, it will be a data frame with 'name',
# 'size', 'type', and 'datapath' columns. The 'datapath' column will contain the local filenames where the data can
# be found.
validate(need(input$Interval, "Error: Please provide the Interval in the Binning tab."),
         need(input$Midpoint, "Error: Please provide the Midpoint in the Binning tab."),
         need(input$start, "Error: Please provide the binning starting time in the Binning tab."),
         need(input$end, "Error: Please provide the binning ending time in the Binning tab."))
inFile <- input$fileName

if (as.logical(input$bin)){    #invalid to from by #42
  CatBinNEq(x=pMatrix(),tsCol=input$timeCol, timeFormat=input$timeFormat, valCols=input$valCol, NEq=list(Interval=input$Interval,Midpoint=input$Midpoint,start=input$start,end=input$end,title=input$title),tz=tz)
  # lum, tz, 
  #bMatrix
} else
{
  NULL
}
})          #, striped = TRUE, hover = TRUE, bordered = TRUE, rownames=TRUE)

eventReactive(  
  input$Go,
  {output$resultsP <- 
    #  this doesn't test for parameters being required!!  Not sure why.
    renderPlot({  
    validate(need(input$nClasses, "Error: Please provide the number of Classes in the Plex tab."),
             need(input$foldLen, "Error: Please provide the length for folding the Plexogram in the Plex tab."),
             need(input$RefTime, "Error: Please provide the reference time in the Plex tab."))
    if (as.logical(input$bin)){ 
      dMatrix<-cbind(bMatrix()[[1]],bMatrix()[[2]])
    } else {
      #  how to show on the output panel that no binning was done?
      dMatrix<-cbind(pMatrix()[[input$timeCol]],pMatrix()[[input$valCol]])
    }
    CatPlexigram<-CatPlex(dMatrix, Plex=list(plex=TRUE, nClasses=input$nClasses, foldLen=input$foldLen, RefTime=input$RefTime), title=input$title, timeFormat=input$timeFormat, tz=tz, Debug=FALSE, fileName=input$fileName,shinyRun=TRUE)
    #plot(CatPlexigram$data)
    #  aovData x&y;   p1Data  x&y;     p2Data   x&y
    opar = par()
    # par(font.axis = 2)
    # par(font.lab = 2)
    #npar(family = "AvantGarde")
    plot(as.numeric(CatPlexigram$p1Data[,1]),as.numeric(CatPlexigram$p1Data[,2]),xlab="Time (hours from Reference Time)",ylab=input$title,type="l",bty='n')
    #remove read only list components 
    opar$cin<-NULL
    opar$cra<-NULL
    opar$csi<-NULL
    opar$cxy<-NULL
    opar$din<-NULL
    opar$page<-NULL
    par(opar)
    })   #  renderPlot
}, ignoreInit=TRUE)    #  observeEvent

}

shinyApp(ui = ui, server = server)

Hello @leegi001, if you look above you'll notice the formatting of your message is a little off. If you could repair the formatting this will help myself and others help you. Furthermore, if you can create a minimal representation of your problem others may find it easier to help find a solution. If you have not already, check out the "Getting help" section at Welcome to the RStudio Community! for tips and advice.

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