title: Receiving req.body empty with post form with Express node.js
body: <p>I've got a simply form, that sends POST data to my Node.JS server, with Express. This is the form: </p>
  
  <pre><code>&lt;form method="post" action="/sendmessage"&gt;
    &lt;div class="ui-widget"&gt;
        &lt;input type="text" id="search" data-provide="typeahead" placeholder="Search..." /&gt;
    &lt;/div&gt;
    &lt;textarea id="message"&gt;&lt;/textarea&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The ui-widget and the input is releated with <code>typehead</code>, an autocomplete library from Twitter.
  And this is how I handle the POST request in the server: </p>
  
  <pre><code>app.post('/sendmessage', function (req, res){
  
    console.log(req.body);
  
    usermodel.findOne({ user: req.session.user }, function (err, auser){
  
          if (err) throw err;
  
          usermodel.findOne({ user: req.body.search }, function (err, user){
  
              if (err) throw err;
  
               var message = new messagemodel({
  
                    fromuser: auser._id,
                    touser: user._id,
                    message: req.body.message,
                    status: false
  
               });
  
               message.save(function (err){
  
                    if (err) throw err;
  
                    res.redirect('/messages')
  
               })
  
          });
  
     });
  
  });
  </code></pre>
  
  <p>The console shows me '{}', and then an error with <code>req.body.search</code>, because <code>search</code> is not defined. I don't know what is happening here, and it's not a problem related with the <code>typehead</code> input. Any solution for this problem...?</p>
  
  <p>Thank's advance!</p>