laravel-bootstrap-4-forms icon indicating copy to clipboard operation
laravel-bootstrap-4-forms copied to clipboard

pre-select radio not working

Open wrabit opened this issue 4 years ago • 1 comments

Even though the model value is === 0, it is not pre-selecting the radio when:

{!! Form::open()->fill($model !!}
{!! Form::radio('has_tickets', 'No', 0) !!}

image

<?= $model->has_tickets === 0 ? 'true' : 'false' ?>

Returns 'true';

wrabit avatar Apr 24 '20 07:04 wrabit

The issue is caused by type hinting the $value argument as a string in the checkbox and radio methods:

https://github.com/netojose/laravel-bootstrap-4-forms/blob/a90c5ada728828793bd81347bdff38e2d2bd6a16/src/FormService.php#L440

Can I ask why? Why not just let the developer pass through their own raw variable. So number can be with or without quotes?

wrabit avatar Apr 24 '20 07:04 wrabit