Current Behaviour:
Toggle fields ("type": "boolean") in self-service action form do not currently support the "required" validation.
There is no built-in way to enforce that a toggle must be explicitly set to true or false before submission.
Problem:
Without "required" support, it is impossible to enforce explicit user action on toggles in cases where confirmation or a deliberate choice is critical. This can lead to accidental submissions without the user enabling or disabling important settings.
Proposed Solution:
Introduce "required": true support for toggle fields so that the form can validate that the user has explicitly set the toggle to the required value before proceeding.
Example:
"toggle": {
"type": "boolean",
"title": "Enable Feature",
"default": false,
"visible": true,
"required": true
}
This would ensure that validation fails unless the toggle is explicitly set to true.
Example Use Cases:
  • Explicit Confirmation – Require true to confirm that the user has read and agreed to terms and conditions.
  • Mandatory Feature Activation – Require true to enable a critical feature (e.g., API access, two-factor authentication).
  • Security or Compliance Setting – Require true to enable encryption or logging for compliance purposes.
  • Mandatory Opt-Out – Require false to ensure the user has actively chosen to disable a feature.
  • Mode Switching – Require true to confirm a switch from testing to production mode.
Benefits:
  • Adds missing parity with other field types that already support "required".
  • Improves form validation capabilities for boolean fields.
  • Helps ensure critical settings are explicitly confirmed by the user.
Notable Workaround:
it is a known UX and validation design limitation in many frameworks. The workaround is to use a hidden, required, and disabled input field that depends on the toggle being true.
  • If the toggle is true, the field returns true.
  • If the toggle is false, the field returns null.
Because the field is required, a null value will fail validation, preventing the form from advancing to the next step or allowing the user to execute the action.
Created by Samiru Musa Haruna
·