I need a pointer or sample tutorial or some examples to form handling in Node.js. I have a form.html which has 3 buttons "Forward", "Backward", "Stop" and they will have to call a process get and appropriately send messages to the backend component to take appropriate action. My sample node.js that comes when I create the application is good, but it does not have form processing, so a link to some worked examples would help a lot.
Asked
Active
Viewed 78 times
1 Answers
1
You can use the express framework to process the form.
<form action="/processForm" method="POST">
What's your name?: <input type="text" name="yourname"><br>
<input type="submit" value="Forward">
</form>
node backend:
app.post('/processForm',function(req,res){
var yourname=req.body.yourname;
res.end("Hello " + yourname);
});
Great tutorials: https://codeforgeek.com/2014/09/handle-get-post-request-express-4/ http://www.hacksparrow.com/form-handling-processing-in-express-js.html

Ram Vennam
- 3,536
- 1
- 12
- 19
-
Thanks Ram, Let me give it a try. – Shashi Kiran Feb 08 '16 at 16:34
-
Ram, Followed your notes .. and I was able to get somethings going - Just acknowledging thanks. – Shashi Kiran Feb 10 '16 at 04:10
-
Great. If my answer worked, I would appreciate it if you can accept it. – Ram Vennam Feb 10 '16 at 04:38
-
John - Thanks for the note - I just updated the answer. Newbie here. – Shashi Kiran May 16 '16 at 16:07