I am trying to get the entered details by the user in the form fields so that I can edit and update the selected records. But, when I click the edit button I am getting blank form fields in the form.
router.get('/list', (req, res) => {
Employee.find((err, docs) => {
if (!err) {
res.render("employee/list", {
list: docs,
});
}
else {
console.log('Error in retrieving employee list :' + err);
}
});
})
I am not able to get what went wrong. I have passed the user entered value as req.body
. All the operations are working properly but could not update the records as I am not able to get the user id from the form.
<tbody>
{{#each list}}
<tr>
<td>{{this.name}}</td>
<td>{{this.email}}</td>
<td>{{this.mobile}}</td>
<td>{{this.city}}</td>
<td>
<a href="/employee/{{this._id}}"><i class="fa fa-pencil fa-lg" aria-hidden="true"></i></a>
<a href="/employee/delete/{{this._id}}" onclick="return confirm('Are you sure to delete this record ?');"><i class="fa fa-trash fa-lg" aria-hidden="true"></i></a>
</td>
</tr>
{{/each}}
</tbody>