Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Ability to have default boolean as 'null', and conditional check for said 'null' state #306

Open
theodeyle opened this issue Jul 13, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@theodeyle
Copy link

Is your feature request related to a problem? Please describe.
When I have a conditional set upon another field that is itself a conditional, it will be displayed even though the value it is dependent on is not shown.

An example is in the following form, the role_change_date is dependent on the offboard_flag being false, and the offboard_flag is dependent on the replacement_flag being true. But when the replacement_flag is false, the role_change_date field will show.

{
  "title": "Onboard New User",
  "name": "getNewUser",
  "fields": [
    {
      "name": "user_name",
      "label": "User Name",
      "description": "",
      "isRequired": true,
      "input": {
        "type": "text"
      }
    },
    {
      "name": "user_role",
      "label": "Role",
      "description": "",
      "isRequired": true,
      "input": {
        "type": "note",
        "folder": "2 - Areas/Work/Roles"
      }
    },
    {
      "name": "start_date",
      "label": "Start Date",
      "description": "",
      "isRequired": false,
      "input": {
        "type": "date"
      }
    },
    {
      "name": "location",
      "label": "Location",
      "description": "",
      "isRequired": true,
      "input": {
        "type": "note",
        "folder": "2 - Areas/Work/Groups/Locations"
      }
    },
    {
      "name": "replacement_flag",
      "label": "Replacement?",
      "description": "",
      "isRequired": false,
      "input": {
        "type": "toggle"
      }
    },
    {
      "name": "current_user",
      "label": "Current User",
      "description": "",
      "isRequired": false,
      "condition": {
        "dependencyName": "replacement_flag",
        "type": "boolean",
        "value": true
      },
      "input": {
        "type": "select",
        "source": "notes",
        "folder": "2 - Areas/Work/People/Users/Active",
        "options": []
      }
    },
    {
      "name": "offboard_flag",
      "label": "Offboarding?",
      "description": "",
      "isRequired": false,
      "condition": {
        "dependencyName": "replacement_flag",
        "type": "boolean",
        "value": true
      },
      "input": {
        "type": "toggle"
      }
    },
    {
      "name": "offboarding_date",
      "label": "Offboarding Date",
      "description": "Date the user will be offboarded",
      "input": {
        "type": "date",
        "allowUnknownValues": false
      },
      "condition": {
        "dependencyName": "offboard_flag",
        "type": "boolean",
        "value": true
      },
      "isRequired": false
    },
    {
      "name": "role_change_date",
      "label": "Role Change Date",
      "description": "",
      "input": {
        "type": "date",
        "allowUnknownValues": false
      },
      "condition": {
        "dependencyName": "offboard_flag",
        "type": "boolean",
        "value": false
      },
      "isRequired": false
    }
  ],
  "version": "1",
  "template": {
    "createCommand": true,
    "parsedTemplate": []
  }
}

Describe the solution you'd like
It would be preferred if there was a third state of null/not set, etc., so that it could be checked in conditionals further down the list.

Additional context
Note "Role Change Date" field displayed, despite the Replacement flag being set to false. If toggles could be null, and conditionals could be checked for it, this would be remedied.

image

@theodeyle theodeyle added the enhancement New feature or request label Jul 13, 2024
@danielo515
Copy link
Owner

The problem here is that boolean/toggles are always set to a value. This was to overcome a limitation that I can't recall right now, but it was there for a reason. I have to review why

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants