However, it permits the NULL value too. Yes, my database for historical reasons permits NULL, but I would prefer the user to pick yes or no. (And not have the NULL option). Ideally via a radio button since a drop down takes longer.
You are right, checkbox_boolean is not implemented. I forgot to remove it from the documentation. The main reason was that it wasn’t working as expected at the quick search. I will revisit this and let you know. Maybe I will add it to a future version.
However, it permits the NULL value too. Yes, my database for historical reasons permits NULL, but I would prefer the user to pick yes or no.
And this is the expected behaviour. Please keep in mind that in case you would like to not permit NULL values, either have it as required field with requiredFields | Grocery CRUD v3 , either to user callbackBeforeInsert and callbackBeforeUpdate and in case the user has empty value to change it to “0”
Let me know if that is ok for now for the dropdown list.
For the initial Yes/No Checkbox, I am still checking to see if I can have it to a short-term future version.
Thanks for the suggested work arounds of callbackInsert and callbackUpdate. I think it would be more complicated to use those and that would make the UI a bit clumsy… I’ll wait for a radio button in a future release.
That said, I would argue that accepting a NULL is unexpected behavior. Yes it is valid in my MySQL field which is enumerated. However you see I only enumerated two values in the fieldType:
['0' => 'No', '1'=>'Yes']
The input routine should only allow those but not NULL. Another example if the table had enumerated values of (Yes, No, Maybe, Crazy) and one specified the fieldType with only Yes or No. In this case, the drop down only show Yes or No as choice. It shouldn’t show Maybe or Crazy.
Perhaps if one wanted to provide a NULL option then NULL would also go in the list like this: