I have 2 checkboxs inside a form, I can't post value of them. I have already tried this:
<div class="form-group col-md-4">
<label class="col-md-6" for="invoiced">
<input type="checkbox" id="invoiced" value="false" name="project[invoiced]">
Invoiced </label>
<label class="col-md-6" for="tobeinvoiced">
<input type="checkbox" id="tobeinvoiced" value="true" name="project[tobeinvoiced]" checked>
To be Invoiced </label>
</div>
with this script that changes the value of 2 checkboxes in true or false:
<script type="text/javascript">
$('#tobeinvoiced').change(function(){
cb = $(this);
cb.val(cb.prop('checked'));
});
$('#invoiced').change(function(){
cb = $(this);
cb.val(cb.prop('checked'));
});
</script>
but when I submit, the values passed are set to null.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire