I was trying to repopulate the checkbox fields after the validation in Laravel. Actually the checkbox fields name as an array. Example:
<form name="" action="" method="post">
<div class="row>
<input type="checkbox" name="models[]" value="1">Model 1
<input type="checkbox" name="models[]" value="2">Model 2
<input type="checkbox" name="models[]" value="3">Model 3
<input type="checkbox" name="models[]" value="4">Model 4
<input type="checkbox" name="models[]" value="5">Model 5
</div>
<div class="row>
<input type="checkbox" name="model_name" value="" placeholder="Model Name">
</div>
<div class="row>
<input type="submit" name="submit" value="submit">
</div>
</form>
My form will look like this. So after submitting the form there will be a validation error and i need to repopulate the check box value after the validation error. I have already tried with to make the checkbox as checked. But it is not working. Anyone have the solution for this to resolve the issue?
Aucun commentaire:
Enregistrer un commentaire