Boolean field should not show "N/A" option when set to required

Created on 12 December 2024, 5 months ago

Problem/Motivation

Normally, a Boolean field when set to required shows no "N/A" option. Good and normal. When you create conditions that make a previously unseen and not required Boolean to, seen and now required, a UI issue arises where the "N/A" option still persists as though it was a not required Boolean field. Below you can see "What is your employment status has triggered the subsequent Boolean field which is required. You can also notice two * * required stars appear.

Steps to reproduce

Create a conditional that produces a Boolean field to appear and be required. Set this to display with radio buttons.
View and trigger the condition in the form.

Proposed resolution

I think this issue may require extra steps to remove the "N/A" option if it can't be caught earlier. Instinct tells me, it's already there as not required, but the switch to required, does not clean-up the options.

πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States goose2000

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @goose2000
  • πŸ‡ΊπŸ‡ΈUnited States goose2000
  • πŸ‡³πŸ‡±Netherlands bram.velthoven

    Has there been any progress on this issue? I’m encountering a similar situation where a field becomes visible and required based on a specific field selection, yet the 'N/A' option remains available. Any insights on resolving this?

  • @bramvelthoven opened merge request.
  • πŸ‡³πŸ‡±Netherlands bram.velthoven

    I worked on a patch removing the "N/A" option from the field when conditional_fields set the form-items to required. Since this is CSR we needed to do some magic to detect the "N/A" option and hide it accordingly.

    I also updated the phpstan because the CI pipeline gave me problems.

Production build 0.71.5 2024