title: R Shiny: Check if and which dropdown menu has been clicked within observe()
body: <p>I'm currently building a Shiny application in which users can filter data based on five dropdown menus. Those menus should behave like Excel's filter function, e.g.: Choose option in menu #1, filter the data for the other four menus depending on the input of the first menu. Choose option in menu #2, filter again all other inputs for the menus, but (and thats very important) keep the input of menu #1 selected and(!) filtered based on the new input.</p>
  
  <p>In a first try, I coded this structure with five observeEvent() functions, one for each dropdown menu. Which worked, but produced loads of code, as the filter and update mechanics are quite big.</p>
  
  <p>I'm currently revising my code and I thought that I could collapse the five observeEvent() functions into one observe() function, as the major part of the filter mechanism is completly equal for all five menus.</p>
  
  <p>The problem that I am encountering now is that I would need a function which tells me which input field has changed. The flush event now checks all input fields in the observe() function. A test with is.null() can't be used, as an empty dropdown menu is also a "change" that needs to be checked (e.g. a user changed his mind and now doesn't want to filter with menu #1)</p>
  
  <p>Example code where the error occurs and a function like "is.active" or "ic.clicked" would be really useful:</p>
  
  <pre><code>observe({
  
  #reset values on each flush event
  which_input &lt;&lt;- ""
  bmodel_content &lt;&lt;- ""
  country_content &lt;&lt;- ""
  company_content &lt;&lt;- ""
  
  #check which input has changed
  #save the name and content for later update statements
  if(!is.null(input$bmodel))
  {
    bmodel_content &lt;&lt;- input$bmodel
    which_input &lt;&lt;- "bmodel"
  }
  else if(is.null(input$bmodel))
  {
    bmodel_content &lt;&lt;- c(unique(data$business.model))
    which_input &lt;&lt;- "bmodel"
  }
  if(!is.null(input$country))
  {
    country_content &lt;&lt;- input$country
    which_input &lt;&lt;- "country"
  }
  else if(is.null(input$country))
  {
    country_content &lt;&lt;- c(unique(data$country))
    which_input &lt;&lt;- "country"
  }
  
  (... another 3 if-else statements for the other 3 menus ...)
  
  ###
  #ERROR: "which_input" should be set with the name of the changed input field
  #       now it is always set to the last if-else-statement
  ###
  
  (... filter data and updateSelectizeInput statements...)
  </code></pre>
  
  <p>Is there a way to check for the changed menu or do I need to go back to observeEvent?</p>
  
  <p>Many thanks in advance!</p>