vendredi 27 mars 2015

I can't find out why req.param('length') is returning 0

I'm using Sails.js (which is based on Express), and I'm sending a form input named length which has a value of '1000', like so:



<select name="length">
<option value="1000">1000</option>
</select>


Server side, I have done some tests, and this is what I get



req.param('length'); // returns 0
req.params.length; // returns 0
req.params.all() // returns { length: '1000' }


I've also checked in the network tab of the developer's console, and I see the POST request being made, with a param of length = "1000".


Either I'm missing something very obvious or this is a weird glitch. Why is this happening and how can I get the value of length instead of getting "0"?


Thanks.


Aucun commentaire:

Enregistrer un commentaire