Jade forms returning empty body to express upon Node.js POST request -
I create a frontend for the flight log database as part of my training to express and node jade. I am using . I have confirmed that my body is transcendental, and my paths are visible, even then my recycled object is undefined. My question is that here is a field in my Jade form:
.row.col-sm-16 div.input-group.form- control form (verb = '', method = 'Post') div (Data-roll = 'Field Contain') field (Data-roll = 'Control Group') label (= 'for HobusAut') HobbsOut & amp; Nbsp & amp; Nbsp & amp; Input (id = 'HobbsOut', type = 'text', value = '', placeholder = 'generates in generator', name = 'hobsut') for each field The things done below are repeated. Submit button:
submit div.text-centre button.btn.btn-default.input-group-button combine with button div The 'Data-roll' divisual route has been done:
App post ('/ login', ctrl.addFlight); and related controllers:
module.exports.addFlight = function (req, res) {console.log (req.body.HobbsOut); Res.redirect ('/ loglist'); }; Currently I'm just trying to print the first field and redirect the user to the fly log. I'm having this problem in more than one application. It is imperative that I know how to push user input into a database. Any and all help is highly appreciated.
edit 1:
Trying to send the request with the HobbsOut value and corrent url ( '/ logadd' ) with the postal code request is being sent to our case) Fiddler's Use?
Can you provide the form HTML instead of the Jade Template? Because the Z-templing engine has nothing to do with the problem you're facing, your problem should probably be one of 3:
- The generated HTML is not correct.
- The form that is posting data is not correct
- The server side failed to parse the data sent in the HTTP post request. Older Posts:
You need it to add support for parsing the data inside the form:
var express = require ('express') var bodyParser = require ('body-parser') var app = express () // parse application / x-www-form-urlencoded app.use ( BodyParser.urlencoded ({expanded: incorrect})) Adds form body piercing with the content type application in the last line
HTML>
Comments
Post a Comment