title: Find form field length in nodejs
body: <p>I have following code for finding length of submitted form field length. </p>
  
  <pre><code>exports.changeStatus = function(req, res) {
  res.header("Access-Control-Allow-Origin", "*");
  var access_token=req.body.access_token;
  var status=req.body.statuse;
  var access_token_aray=new Array();
  var respon="";
  var errorcode="";   
  connection.query('Select `access_token`,`status` from `userss`',function(err,row,field){
  
  
      if((access_token.length==0)||(status.length==0)){
          respon="Please fill all the fields.";
          errorcode=100;
      }
  
      /*else if(access_token_aray[access_token]!==1){
          respon="Invalid access_token";
          errorcode=101;
      }
      */
      if(errorcode){
          respon = {"error" : respon, "error-code" : errorcode};
      }
      /*
      else{
          respon = {"log" : 1, "access_token" :access_token };
      }       
          */
      res.send(JSON.stringify(respon,0,4)); 
  
  
  });
  </code></pre>
  
  <p>But it is giving me following errror</p>
  
  <pre><code>TypeError: Cannot read property 'length' of undefined
      at Query._callback (/home/group3/www/friends/routes/status.js:23:19)
      at Query.Sequence.end (/home/group3/www/friends/node_modules/mysql/lib/protocol/sequences/Sequence.js:78:24)
      at Query._handleFinalResultPacket (/home/group3/www/friends/node_modules/mysql/lib/protocol/sequences/Query.js:143:8)
      at Query.EofPacket (/home/group3/www/friends/node_modules/mysql/lib/protocol/sequences/Query.js:127:8)
      at Protocol._parsePacket (/home/group3/www/friends/node_modules/mysql/lib/protocol/Protocol.js:197:24)
      at Parser.write (/home/group3/www/friends/node_modules/mysql/lib/protocol/Parser.js:62:12)
      at Protocol.write (/home/group3/www/friends/node_modules/mysql/lib/protocol/Protocol.js:37:16)
      at Socket.ondata (stream.js:51:26)
      at Socket.EventEmitter.emit (events.js:117:20)
      at Socket.&lt;anonymous&gt; (_stream_readable.js:720:14)
  </code></pre>