Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Creating a Working Registration Form

Hello everyone. I'm needing some help understanding something. I know how to create and style a form with HTML and CSS. I just need to know how to make it function. Can i do this completely with JavaScript and Node.js? What are the components and knowledge you need?

I've read a bit and I think I need a database for the Form to "post" to? Or does it post to the server? I've heard I need a server-side language, but Node.js makes JavaScript run Server-Side doesn't it?

I wasn't sure which topic to post this under. If you feel it needs to be somewhere else, Please let me know :) Thank you all very much for helping me sort this out.

1 Answer

Kevin Korte
Kevin Korte
28,149 Points

There are a couple of options, and Node is one option that can handle form data. Any server side language will have ways to receive data, and than do something with it. The form itself does actually just post to the server, from there, it's our job to tell the server what to do with the form.

The most common is the form data gets posted into a database, that is pretty standard. However, the submitted form could just be generated into an email and sent out by the server. Say you has a simple contact form on your personal website, you could just have the server email you the form contents to your gmail account instead of posting to a database.

Okay. I understand. I'm learning JavaScript now. If i use Node, I wouldn't have to learn another language? I could create the DB with JS and just tell it what to do with the form? I really don't want to have to learn another language, but I will if i have to.

Kevin Korte
Kevin Korte
28,149 Points

Right, Node is just js that does server side stuff, so it's the same familiar syntax.