title: Dynamic selectInput in R shiny
body: <p>I have 3 selectInput boxes and a pool of 4 options which can be selected by these 3 boxes. I want the options displayed by the selectInputs to change dynamically as other selectInputs are selected. However I want the "NONE" option to be available at all points of time for all the three boxes. The code I am using is </p>
  
  <pre><code>    library(shiny)
      library(shinydashboard)
  
  
      ui &lt;- dashboardPage(
        dashboardHeader(title = "Dynamic selectInput"),
        dashboardSidebar(
          sidebarMenu(
            menuItemOutput("menuitem")
          )
        ),
        dashboardBody(
          uiOutput('heirarchy1'),
          uiOutput('heirarchy2'),
          uiOutput('heirarchy3')
        )
      )
  
      server &lt;- function(input, output) {
        output$menuitem &lt;- renderMenu({
          menuItem("Menu item", icon = icon("calendar"))
        })
  
        heirarchy_vector&lt;-c("NONE","A","B","C")
        output$heirarchy1&lt;-renderUI({
          selectInput("heir1","Heirarchy1",c("NONE",setdiff(heirarchy_vector,c(input$heir2,input$heir3))),selected="NONE")
        })
  
  
        output$heirarchy2&lt;-renderUI({
          selectInput("heir2","Heirarchy2",c("NONE",setdiff(heirarchy_vector,c(input$heir1,input$heir3))),selected="NONE")
        })
  
        output$heirarchy3&lt;-renderUI({
          selectInput("heir3","Heirarchy3",c("NONE",setdiff(heirarchy_vector,c(input$heir1,input$heir2))),selected="NONE")
        })
  
      }
  
      shinyApp(ui, server)
  
  Any help on this will be greatly appreciated
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried using updateSelectInput for this purpose. However the code doesn't seem to run</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  
  
  ui &lt;- dashboardPage(
    dashboardHeader(title = "Dynamic selectInput"),
    dashboardSidebar(
      sidebarMenu(
        menuItemOutput("menuitem")
      )
    ),
    dashboardBody(
      selectInput("heir1","Heirarchy1",c("NONE","A","B","C"),selected="NONE"),
      selectInput("heir2","Heirarchy2",c("NONE","A","B","C"),selected="NONE"),
      selectInput("heir3","Heirarchy3",c("NONE","A","B","C"),selected="NONE")
    )
  )
  
  server &lt;- function(input, output) {
    output$menuitem &lt;- renderMenu({
      menuItem("Menu item", icon = icon("calendar"))
    })
  
    heirarchy&lt;-c("A","B","C")
  
    observe({
      hei1&lt;-input$heir1
      hei2&lt;-input$heir2
      hei3&lt;-input$heir3
  
      choice1&lt;-c("NONE",setdiff(heirarchy,c(hei2,hei3)))
      choice2&lt;-c("NONE",setdiff(heirarchy,c(hei1,hei3)))
      choice3&lt;-c("NONE",setdiff(heirarchy,c(hei1,hei2)))
  
      updateSelectInput(session,"heir1",choices=choice1)
      updateSelectInput(session,"heir2",choices=choice2)
      updateSelectInput(session,"heir3",choices=choice3)
  
    })
  
   }
  
  shinyApp(ui, server)
  </code></pre>