Boolean Fields in GC Enterprise 3 and postgresql

Boolean fields work fine in GC Enterprise 2, but not in version 3.

I have dealt with the following:

   $crud->fieldType('nacional','checkbox_boolean',['1' => 'true', '' => 'false']);

    $crud->fieldType('nacional','dropdown', [
        null => 'no',
        1 => 'yes'
    ]);

    $crud->fieldType('nacional','dropdown', [
        0 => 'no',
        1 => 'yes'
    ]);

    $crud->fieldType('nacional','dropdown', [
        '0' => 'no',
        '1' => 'yes'
    ]);

And it still doesn’t work.

Can you help me, please

Hello @NOLO ,

You are right, we currently don’t have the boolean field since it was a bit buggy on the previous version. I want to revisit that in the future though. I was thinking having a check symbol like this ✓ and an uncheck like this ✘ . This is in order to recognise the difference between an empty field and a field that have the “no” value.

What do you think?

Regards
Johnny

Excellent Johnny, for now, I made a small adjustment to the model and the states to include a method, “cast”, which converts the boolean to integer and can be used with “Yes”, “No”. :slight_smile:

Nice one. In the meantime I have already started working on a new field type with name “boolean”. I will keep you updated once this is done.

Regards
Johnny

Hello @NOLO ,

I am glad to inform you that the version 3.1.1 now has the field type “boolean”. Enjoy :slight_smile:

1 Like