In Laravel 5.1 Can't Post Value Of Checkbox
I have 2 checkboxs inside a form, I can't post value of them. I have already tried this:
Solution 2:
I've found the solution to my problem, this is the link : Solution.
My code became:
<label class="col-md-6"for="invoiced">
<input type="checkbox" key="invoiced"/>
<input type="hidden"id="invoiced" value="0" name="project[invoiced]">
Invoiced </label>
<label class="col-md-6"for="tobeinvoiced">
<input type="checkbox" key="tobeinvoiced" checked/>
<input type="hidden"id="tobeinvoiced" value="1" name="project[tobeinvoiced]">
To be Invoiced </label>
with this script:
$(document).ready(function () {
$('[key]').change(function () {
var key = $(this).attr('key');
$($('[name="project[' + key + ']"]')).val($(this).is(':checked') ? 'true' : 'false');
});
});
Post a Comment for "In Laravel 5.1 Can't Post Value Of Checkbox"