formers / former

A powerful form builder, for Laravel and other frameworks (stand-alone too)
https://formers.github.io/former/
1.34k stars 204 forks source link

Checkboxes unchecked not inside request->old() #566

Closed yannrobin closed 6 years ago

yannrobin commented 6 years ago

Hello,

When there is an error in the form we can get the inputs with request->old() in an array, if there is a checked checkbox the value will be 'name' => string '1' but if the checkbox is unchecked there is not entry for the checkbox. In the logic the value should be 'name' => string '0'.

Here an example of checked checkbox request->old() array :

array (size=3) 'input1' => null 'checkbox' => string '1' (length=1) '_token' => string 'mytoken'

Here an example of unchecked checkbox request->old() array :

array (size=2) 'input1' => null '_token' => string 'mytoken'

Is there any reason for that ?

Thanks

yannrobin commented 6 years ago

Fixed by changing in the following the config/former.php

'push_checkboxes' => true,