Getting error "TypeError: Cannot read property 'Name' of undefined" while form submitting in node.js

itunes error codes
apple error
imessage activation error
iphone update error 14
iphone restore error
facetime activation error on mac
error 11 itunes
itunes error 35

I want to store html form data in JSON file But getting error.

"TypeError: Cannot read property 'Name' of undefined"

And also tell me how to create json file from string JSON. And how to add data from multiple users.

My html file is:

<!DOCTYPE html>
<html>
<head>
    <title>Sign up</title>
    <style type="text/css">
    div {
        background-color: rgb(66, 244, 229);
        padding: 15px;
        margin: auto;
        width: 300px;
        border-radius: 7px;
    }
    input {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }
    input[type=submit] {
        border-radius: 5px;
        border: none;
        margin: auto;
        background-color: orange;
        color: white;
    }
    </style>
</head>
<body>
    <div>
        <form action="/form" method="Post">
        <input type="text" name="Name" placeholder="Enter your Name"><br> 
 <br>
        <input type="email" name="Email" placeholder="Enter Email id"><br> 
 <br>
        <input type="password" name="Password" placeholder="Set Password"> 
   <br><br>
        <input type="number" name="Mobile" placeholder="Enter mobile 
  number"><br><br>
        <input type="submit" value="submit">
    </form>
</div>
</body>
</html>

And my Server.js file is:

var express= require('express');

var app= express();

app.use("/public", express.static(__dirname + "/public"))

app.all('/', function(req, res) {
res.sendFile('/express.js/public/signup.html');
});

app.post("/form", function(req, res){
    var username= req.body.Name;
    var email= req.body.Email;
    var mobile= req.body.Mobile;
    var password= req.body.Password;

    var object= { name_new:username, mail: email, pass_word:password, 
     Mobile_No: mobile}
    var json= JSON.stringify(obj);
   });

app.listen(1111);

you have to parse your request with body-parser packages

npm install body-parser --save

include body-parser on routes

var bodyParser = require('body-parser')
app.use(bodyParser.urlencoded({ extended: false }))

Now you will able to get all post data inside routes.

Facebook Getting error message : Sorry, something went wrong , Get more help. If you tried these steps and saw the error again, follow the steps for your error code. Information about products  Tech support scams are an industry-wide issue where scammers trick you into paying for unnecessary technical support services. You can help protect yourself from scammers by verifying that the contact is a Microsoft Agent or Microsoft Employee and that the phone number is an official Microsoft global customer service number.

Please check out the manual of expressjs. You need a body-parsing middleware

req.body Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware such as body-parser and multer.

http://expressjs.com/en/4x/api.html#req.body

If you see an error when you update or restore your iPhone, iPad, or , To use iMessage or FaceTime, you need to activate them on your iPhone, iPad, or iPod touch. If you see an error message during activation,  This article will help you troubleshoot and fix common activation errors in Windows. For help finding your product key, see Find your Windows product key . For troubleshooting and other info about updating Windows 10, see Windows 10 Update: FAQ or Troubleshoot problems updating Windows 10 .

You need to use a body parser to be able to use req.body in a post route:

var express= require('express');
var bodyParser = require('body-parser')

var app= express();

// parse forms with MIME type application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))


app.use("/public", express.static(__dirname + "/public"))

app.all('/', function(req, res) {
res.sendFile('/express.js/public/signup.html');
});

app.post("/form", function(req, res){
    var username= req.body.Name;
    var email= req.body.Email;
    var mobile= req.body.Mobile;
    var password= req.body.Password;

    var object= { name_new:username, mail: email, pass_word:password, 
     Mobile_No: mobile}
    var json= JSON.stringify(obj);
   });

app.listen(1111);

From the documentation of body-parser:

bodyParser.urlencoded([options])

Returns middleware that only parses urlencoded bodies and only looks at requests where the Content-Type header matches the type option. This parser accepts only UTF-8 encoding of the body and supports automatic inflation of gzip and deflate encodings.

A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body). This object will contain key-value pairs, where the value can be a string or array (when extended is false), or any type (when extended is true).

If you get an error when trying to activate iMessage or FaceTime , Users typically receive an error message when they're unable to access something or get something done. Whether it's a system error or a user  Press and hold (or right-click) the device name and select either Update Driver Software or Uninstall to correct the errors. Remove third-party security software. Make sure you know how to reinstall your programs and that any necessary product keys are on hand. Windows Defender will help protect your device in the meantime. Repair hard-drive errors.

Getting Your Error Messages Just Right, I'm getting an error message. Select the error message that you're seeing below for help in resolving the issue. Android ComputeriPhone & iPad. More. More. ssl A pointer to a token returned on the SSL_new call. ret The return code from the previous SSL API call.

I'm getting an error message - Android, Get help with a specific error message. "This webpage has a redirect loop" or "​ERR_TOO_MANY_REDIRECTS". 503 Service Unavailable errors can appear in any browser in any operating system, including Windows 10 back through Windows XP, macOS, Linux, etceven your smartphone or other nontraditional computers.

Fix connection errors - Google Chrome Help, If you get an error message when you try to activate your TV, Blu-ray player, set-​top box, or other Netflix ready device, it typically points to a network connectivity  Most of the time, "wrong" means an issue with the page or site's programming, but there's certainly a chance that the problem is on your end, something we'll investigate below.

Comments
  • Welcome to SO! What happens when you add console.log(JSON.stringify(req.body)) before your var username= req.body.Name; ?
  • install body-parser and add app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true})); after var app= express();
  • It is showing Undefined.
  • Still showing undefined @WTFtom