title: Posting Textarea to Controller (currently null is being passed) - MVC
body: <p>I'm creating a website where the user will fill in a textarea (in response to a question) and then press next. When they press next, the textarea will be submitted to the controller and the next question will be retrieved (I'll also store the answer in a cookie). Unfortunately, when I run the code in debug I've realized that the textarea is not being submitted b/c the parameter is null. I've tried to figure it out and I've looked around and I seem to be doing it properly. Hopefully it's an easy fix. Thanks so much for your time!</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>// POST: /Question/1 
  [HttpPost]
  public ActionResult q(string textAnswer) {
      if (textAnswer != null)
          ViewBag.current++;
  
      Question q = db.Questions.Find(ViewBag.current);
      if (q == null) {
          return RedirectToAction("submit");
      }
  
      return View(q);
  }
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;form class="form-horizontal" id="myForm" method="post" enctype="text/plain" name="input"&gt;
  
      &lt;p&gt;
          &lt;h3&gt;Question &lt;span id="integer"&gt;@ViewBag.current&lt;/span&gt;&lt;/h3&gt;
          @Html.DisplayFor(model =&gt; model.Ques)
      &lt;/p&gt;
  
      &lt;div class="control-group"&gt;
          &lt;label class="control-label"&gt;Answer&lt;/label&gt;
          &lt;div class="controls"&gt;
              &lt;textarea rows="20" style="width:600px" id="textAnswer"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="control-group"&gt;
          &lt;div class="controls" &gt;
              &lt;button onclick="history.back()" type="button" class="btn"&gt;Back&lt;/button&gt;
              &lt;input type="submit" class="btn" value="Next" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/form&gt;
  </code></pre>