formers/former

Checkboxes unchecked not inside request->old()

yannrobin opened this issue · 1 comments

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

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

'push_checkboxes' => true,