0
I have a form where the user can enable or disable certain options by checking or not a checkbox
.
<input name="ppra" type="checkbox" data-oFF-text="INATIVO" value="1"
data-off-color="danger" data-size="small" data-on-text="ATIVO"
data-on-color="success" {{ $cliente->ppra == 'ativo' ? 'checked' : '' }}
onchange="checkStat(this, 'check-ppra');" id="check-ppra">
I created a function so that when a checkbox
your value
becoming "active" and when it is cleared it will be "inactive".
function checkStat(input, name) {
if(input.checked == true){
$("#"+name).val('ativo');
}else{
$("#"+name).val('inativo');
}
}
But I realized that when the checkbox
is unchecked it simply is not sent on request
, he sends the ppp, the pcmso and ignores the ppra who was feeling inactive.
I have already checked and seen that the function that assigns the value
for active or inactive works properly.
In my controller
I do not specify all fields, I simultaneously take everything and create the record.
$this->repository->update($request->all(), $id);
How can I fix this?