#ToggleButton state return string
11 messages · Page 1 of 1 (latest)
Well, null, true or false isn’t an actual Boolean, right?
It can’t be a bool with 3 options.
If I need to store null, true or false what would be the best option?
In my opinion, a select.
Could do a toggle button with a null option too. If it’s about UI. https://filamentphp.com/docs/3.x/forms/fields/toggle-buttons
But just doesn’t make sense to me to be null, true or false, just default to false.
Good to know. Thanks for your advice.
It really makes sense to use a ToggleButtons default to null and 0 , 1 for boolean
I have an API whose validation is ['required', 'boolean'], or ['boolean']. If I leave it as a checkbox and it is not checked it is null, but it is actually required as false🥲
So just set the default state of the checkbox to false.