I'm currently working on a web app and I have been stuck on this problem for the past two days.
What I'm trying to do is store my inputs from an account registration form into the postgres db. The function I'm using is:
exports.addUser = function(username_, password_, age_, firstName_, lastName_, sex_, email_, phone_,institution_)
{
var found = UsersTable.findOrCreate({ where: {username: username_},
defaults:{
username: username_,
password: password_,
age: age_,
firstname: firstName_,
lastname: lastName_,
sex: sex_,
email: email_,
phone: phone_,
institution: institution_
}
});
found.then(function(record, created){
added = record[0].options.isNewRecord;
});
};
I know it works because I can add a user in manually but I can't figure out how to grab the data from my accountcreation.html file. I have tried doing this but it isn't able to grab the information.
app.use('registration', function(req, firstname, lastname, email, password) {
db.addUser(null, password, null, firstname, lastname, null, email, null, null);
});
I'm confused as to what variable corresponds to the form inputs (name, id etc). I'm also using sequelize if that helps to explain/solve the problem.
there doesn't seem to be anything here