I have not been able to find the answer to this question. When using NodeJS, Express, and the Express Bodyparser - and the rest of my MEAN stack for that matter - I run into an issue with both hidden and disabled fields: they do not show up in the req.body object when submitting a form.
If I understand correctly, the bodyparser aspect of express is actually taken from another project. Regardless, I have not really been able to figure out why these fields are being removed or how to stop this from happening. I suspect it might have something to do with methodoverride, but enabling/disabling this has no effect on the fields in question.
So.. for myself and future googler's: what is happening here?
Here's some code, as requested: JADE:
form(action="/admin/users/edit", method="post", ng-submit='registerUser($event)', name='form', novalidate)
.row(ng-show="ifweareupdating")
label(for="_id") _id:
input(type="hidden", id="_id", name="_id", ng-model="newUser._id")
input(type="text", id="_notHiddenId', name="_notHiddenId", ng-model="newUser._id")
EXPRESS:
app.post("/admin/users/edit", pass.ensureAdmin, userRoutes.editUserPost);
userRoutes:
exports.userRoutes.editUserPost = function(req,res,next) {
console.log(req.body._id) // logs undefined
console.log(req.body._notHiddenId) // logs actual id
}