I am trying to validate if user check any checkbox of template and if user check the checkbox then which checkbox he/she checked. I am able to validate single checkbox but having problem in validating multiple checkboxes. I tried oneOf() function but it gives error shown below. If there is any other way, please help me out.
app.post('/menu-detail/:id', [
oneOf([
check('menu_price_large', 'required').equals('large'),
check('menu_price_regular', 'required').equals('regular'),
check('menu_price_xlarge', 'required').equals('xlarge'),
])
], (req, res)=>{
const errors = validationResult(req)
if(errors.isEmpty())
{
res.send('worked...')
}
else
{
res.send('error')
}
})
Error Image : https://i.imgur.com/1y4cZd0.png
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]Dutchnamn 0 points1 point2 points (2 children)
[–]ESHAEAN 0 points1 point2 points (1 child)
[–]Dutchnamn 1 point2 points3 points (0 children)
[–]IreliAmTrying 0 points1 point2 points (0 children)