I saved the checkbox value in mongoDB. passed the value to the page by
if (req.session.user.Single === undefined) {single_status= 'false'} else {single_status= ''};
res.render('user-profile', {
Single: single_status,
)};
Then i have this in jade
.col-md-4
label-option(for="checkbox")
input(type="checkbox", checked="#{Single}", name='single', id='single')
on the rendered view. It appears checked="false" so it is always checked. how to a return the valve to the checkbox to present the existing checked / unchecked?
<label-option for="checkbox">
<input type="checkbox" checked="false" name="single" id="single"> Single Status
</label-option>
Aucun commentaire:
Enregistrer un commentaire