Click here to Skip to main content
14,735,987 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a form on Handlebar. It generates dynamic textboxes and dropdowns based on which type of form it is. Now I have to submit this form to a nodejs route. There i ahve req.body. We generaly process form field by like req.body.name, req.body.class. I dnt know how to handle dynamic fields in req.body._dynamicfieldname__


The above form control is not dynamic so i can easily process req.body.pin

Now

In this case how can i get the req.body.dynamicfieldname inside nodejs route


routes.post('/applyforadmission', async(req,res)=>{
console.log(req.body);
let dy = req.body.pin;

// how to access req.body.dynamicfieldname (which is dynamically generated on frontend)
res.render('admission');
});

What I have tried:

I tried to set a separate parameter which holds all dynamic names and value. But is there any proper way to do it
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900