Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8999883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:14:20+00:00 2026-06-16T00:14:20+00:00

I am pretty new to Node.js development, and I am aware that there are

  • 0

I am pretty new to Node.js development, and I am aware that there are several stack overflow questions like this already, unfortunately none seem to fix my problem. So I feel all I can do is ask my question

So I am use Node.js with Express and the Jade view engine.

I based some of my code on this article : http://howtonode.org/express-mongodb

Anyway here is what I have

The node app :

var express = require('express');
var home = require('./routes/home');
var d3demo = require('./routes/d3demo');
var PersonProvider = require('./public/javascripts/personProvider').PersonProvider;
var personProvider = new PersonProvider('localhost', 27017);
var LinkProvider = require('./public/javascripts/linkProvider').LinkProvider;
var linkProvider = new LinkProvider('localhost', 27017);


var http = require('http');
var path = require('path');
var app = express();

//=============================================================================
//    EXPRESS SETUP
//=============================================================================
app.configure(function(){
  app.set('port', process.env.PORT || 2000);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.favicon());
  app.use(express.logger('dev'));
  //app.use(require('connect').bodyParser());
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(require('stylus').middleware(__dirname + '/public'));
  app.use(express.static(path.join(__dirname, 'public')));
});

app.configure('development', function () {
    app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
});

app.configure('production', function () {
    app.use(express.errorHandler());
});


//=============================================================================
//    ROUTING
//=============================================================================
app.get('/home', function (req, res) {
    home.homeGet(req, res, commonHelper, personProvider, linkProvider);
});

app.post('/home', function (req, res) {
    home.homePost(req, res, personProvider);
});


var server = http.createServer(app);


server.listen(app.get('port'), function(){
    console.log("Express server listening on port " + app.get('port'));
});

and this is the Home route

/*
 * GET home page.
 */

exports.homeGet = function(req, res, commonHelper, personProvider, linkProvider){
        commonHelper.seedData(personProvider, linkProvider, function() {
        res.render('home');
    });
};

exports.homePost = function (req, res, personProvider) {

    var newUserEmail = req.body.email;
    console.log(req.body.length);


    //console.log(x);

    //var email = req.param('Email');
    console.log("/Home posted Email :" + newUserEmail);

    personProvider.save({
        //email: req.param('Email'),
        email: newUserEmail,
    }, function (error, docs) {
        if(error == null) {
            res.redirect('/d3demo');
        } else {
            res.render('home');
        }
    });

};

And this is the jade view

extends layout

block head
  link(rel='stylesheet', href='/stylesheets/home.css')
  script(src='/javascripts/home.js')

block content
  form(method='post', id='homeForm', action='http://localhost:2000/home')
    div(id='dialog', title='error', style='display:none;')
      p You need to supply a valid email
    div(id='NewDetailsArea')
      p Enter your email address, and then click enter 
      | <input type="text" id="email" class="email"></input>
      div#homeSubmit
        input(type='submit', value='Enter', id='enterEmail')

Which gets rendered to this

<form method="post" id="homeForm" action="http://localhost:2000/home">
  <div id="dialog" title="error" style="display:none;">
    <p>You need to supply a valid email</p></div>
    <div id="NewDetailsArea">
      <p>Enter your email address, and then click enter </p>
      <input type="text" id="email" class="email">
      </input><div id="homeSubmit"><input type="submit" value="Enter" id="enterEmail">
    </div>
  </div>
</form>

So the problem:

Well the problem is actually pretty simply. Within the function

homePost = function (req, res, personProvider)

I would like to be able to get the value of the ’email’ form field

I have tried req.param(’email’), req.body.email I have tried the standard express.bodyParser() and also the connect (which someone mentioned in another answer) one require(‘connect’).bodyParser(), but alas all I get is undefined.

Also if I try and console.log(req.body) I get undefined

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:14:21+00:00Added an answer on June 16, 2026 at 12:14 am

    You need to supply a name attribute for the email input. The name is what gets sent when the form is submitted:

    <input type="text" id="email" name="email" class="email">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to wrap my head around Node.js streams, not that I'm pretty new
I'm pretty new to drupal development. I have a group node and inside it
This is a pure best practice question. I am pretty new to Node and
I'm pretty new to Node.js/Express, but I think I'm slowly getting the hang of
Pretty new to MVC and the like. I have a class the looks like
Pretty new to Perl so there may be a very obvious solution here. I'm
I am pretty new to PHP and MySQL and I just can't figure this
I'm still pretty new to ObjC. I noticed that it's pretty standard everywhere to
I'm pretty new to mvc and jQuery... and to web development in general really.
I'm an experienced software developer, but pretty new to JS and to node. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.