title: how do function observe() and reactiveValues() work?
body: <p>I have a form with two different actions. The first one is to upload a file and the second is for an example. When I click one of these my app does something, but the server saves the information of a click and no change until I click on the other button.</p>
  
  <p>For example, if I click the upload button without choose a file, it does nothing, but if I choose a file, the server uploads the file and start to process it without clicking on the upload button because the server has saved the past click. I want to know if is possible to reset the value for each click.</p>
  
  <p>Index.html</p>
  
  <pre><code>&lt;form class="span12 menu-med-upload"&gt;
   &lt;div class="row-fluid"&gt;
    &lt;h3&gt;Upload File .fasta&lt;/h3&gt;
    &lt;div class="custom-input-file btn btn-inverse"&gt;
     &lt;input type="file" size="1" name="fileFasta" id="fileFasta" class="input-file" /&gt;
     Select File
    &lt;/div&gt;
    &lt;img src="/static/img/check.png" class = "custom-input-check"&gt;
    &lt;div class="span12"&gt;&lt;/div&gt;
    &lt;textarea class = "span12" rows  = "10" style="resize: none;" id="textAreaFasta"&gt;
    &lt;/textarea&gt;
   &lt;/div&gt;
   &lt;button id="uploadFasta" type="button" class="btn btn-inverse action-button" &gt;Upload    File&lt;/button&gt;
   &lt;button id="exampleFasta" type="button" class="btn btn-inverse action-button"  &gt;Example&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Server.R</p>
  
  <pre><code>shinyServer(function(input, output, session) {
  
   # Create a reactiveValues object, to let us use settable reactive values
   values &lt;- reactiveValues()
   # To start out, lastAction == NULL, meaning nothing clicked yet
   values$lastAction &lt;- NULL
   # An observe block for each button, to record that the action happened
   observe({
    if (input$exampleFasta != 0) {
     values$lastAction &lt;- 'example'
    }
   })
   observe({
    if (input$uploadFasta != 0) {
     values$lastAction &lt;- 'upload'
    })
   })
  
   # Then you can use values$lastAction in reactive expressions, outputs, etc.
   output$table &lt;- renderText({
    if (is.null(values$lastAction)) 
     return(NULL)
    if (identical(values$lastAction, 'upload'))
     return(myRenderTable(matrixProtein(), "table", nameFile))
    if (identical(values$lastAction, 'example'))
     return(myRenderTable(matrixProteinExample(), "table", ""))
    stop("Unexpected value for lastAction: ", values$lastAction)
   })
  })
  </code></pre>
  
  <p>Note: Joe Cheng made the code of server.R, and I copied to work in this example to <a href="https://stackoverflow.com/questions/18816666/shiny-change-data-input-of-buttons">shiny Change data input of buttons</a></p>