Disable undefined state for smart action boolean field

Expected behavior

I expect boolean inputs to only have “true” and “false” states

Actual behavior

Boolean inputs have three states: “true”, “false” and “undefined”
image
image
image

Context

One of my smart action fields is a boolean field. I want my user to only have two choices for its value: true and false. What am I doing wrong here?

Field definition:

From my forest/table.ts collection file:

{
name: "myAction",
type: "global",
fields: [
        {
          field: 'isEnabled',
          description: '',
          type: 'Boolean',
          isRequired: true,
          defaultValue: false
        },
]
}

From .forestadmin-schema.json

{
        "field": "isEnabled",
        "type": "Boolean",
        "defaultValue": false,
        "enums": null,
        "isRequired": true,
        "reference": null,
        "description": "",
        "position": 0,
        "widget": null
}

Please provide any relevant information about your setup.

“forest-express-sequelize”: “8.0.6”

Thanks!

Hello @AlexisSMT,

You’re doing all great. We just follow a web standard that make checkbox having 3 states. Personally, I find it quite strange since a boolean can only be 2 value (except in a quantum world :joy:).

So I don’t have much thing to overcome this strange limit. I will forward your feedback to the team anyway. (Maybe make a feature request to only let the true/false option available…)

Kind regards,
Morgan

1 Like