Need help with getting year selected from input to limit the number of sites the user can choose in the next input


#1

Here is the section of code that is relevant to the question. What I'm trying to accomplish. Within the ui.R I'm trying to limit the choices of sites a use can pick based on the year chosen. I understand input.year will not work, I'm still new to shiny and not quite sure how to get the current choice from the user.

conditionalPanel(
       condition = "input.plot != 'googlemaps'",
       site1 <- selectInput(
         inputId = "site1",
         label = "Select a first site:",
         choices = dbGetQuery(db, sprintf("SELECT DISTINCT site FROM 'so.mo' WHERE strftime('%%Y',datetime(datetime(date,'unixepoch'))) ='%s'",input.year))
       )
     ),
     selectInput(
       inputId = "species",
       label = "Species:",
       choices = species_choices
     ),
     conditionalPanel(
       condition = "input.plot == 'calendar' || input.plot == 'timeVariation'",
       selectInput(
         inputId ="year",
         label = "Year:",
         choices = year_choices
       )