title: Does ASP.NET MVC swallow submit values?
body: <p>I have a single form in ASP.NET MVC (v1) that has 2 input buttons. Each submit button has to be contained within this single form and I need to know which one the user pressed.</p>
  
  <p>I know about the trick to check the FormCollection values which will be returned based on the button pressed. For example, if I have  and  and the user clicks Button2, I should be able to say Request.Form["Button2"] != null and that will evaluate to true in which case I know that the user clicked that button.</p>
  
  <p>However, this is not working for me. The values of all my buttons is null as non of them are contained within the Request.Form values. Is there a bug in ASP.NET MVC which swallows these values?</p>
  
  <p>Here is my form code:</p>
  
  <pre><code>&lt;% using (Html.BeginForm()) {%&gt;
  
      &lt;% Html.RenderPartial( "EditAreaControl", Model ); %&gt;
  
      &lt;div class="form-layout-command-container"&gt;
          &lt;div class="form-layout-command-area-alpha"&gt;&lt;button type="submit" name="submit1" value="Save"&gt;Save&lt;/button&gt;&lt;/div&gt;
          &lt;div class="form-layout-command-area-alpha"&gt;&lt;button type="submit" name="submit2" value="SaveAndCopy"&gt;Save and Create Copy&lt;/button&gt;&lt;/div&gt;
          &lt;div class="form-layout-command-area-beta"&gt;&lt;%= Html.ActionLink("Cancel", "list") %&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  &lt;% } %&gt;
  </code></pre>
  
  <p>Here is my controller code:</p>
  
  <pre><code>[AcceptVerbs( HttpVerbs.Post )]
  public ActionResult Add(FormCollection values )
  {
     if (values["submit1"] != null)
          // always false
     if (values["submit2"] != null)
          // always false as well
  }
  </code></pre>