Skip to content

Add checkbox group with None and distinguish unanswered arrays - #517

Merged
prestoncabe merged 3 commits into
mainfrom
515-checkbox-group-behavior-on-forms
Sep 27, 2026
Merged

prestoncabe merged 3 commits into
mainfrom
515-checkbox-group-behavior-on-forms

Conversation

@prestoncabe

Copy link
Copy Markdown
Collaborator

Summary

  • Add a Checkbox group with None component with mutually exclusive “None of these” behavior, rendered as the last option in the same list.
  • Support static, input data, and expression option sources.
  • Send null for unanswered array fields, [] for an explicit None answer, and selected values otherwise in both Preview and published screeners.
  • Preserve this distinction when the backend flattens enrollments, and avoid creating missing people or list sections during normalization.
  • Add interaction and normalization tests and document the field behavior.

Closes #515

Verification

  • Frontend tests: 70 passed (using the checked-in emulator dummy API key).
  • Frontend production build: passed.
  • Builder API FormDataTransformerTest: passed during implementation.
  • git diff --check: passed.

Behavior change

Empty ordinary checkbox groups and tag lists now send null. Builders should use Checkbox group with None when respondents need to explicitly answer that none apply.

prestoncabe and others added 3 commits September 27, 2026 12:06
A Checkbox group with None inside an unsubmitted section (e.g. a hidden
spouse section) created people.spouse, adding a person to the household
and nulling the combined enrollments. Missing dynamic lists became
objects. Skip fields whose parent path isn't in the data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
form-js gives an untouched checkbox group or tag list [], which can't be
told apart from a cleared one. Normalize all array fields so an empty
answer is null, and only an explicit None answer from Checkbox group
with None is []. The backend can then read [] as an explicit None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prestoncabe prestoncabe linked an issue Sep 27, 2026 that may be closed by this pull request
@prestoncabe
prestoncabe merged commit 3c61d69 into main Sep 27, 2026
5 checks passed
@prestoncabe
prestoncabe deleted the 515-checkbox-group-behavior-on-forms branch September 27, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checkbox group behavior on forms

1 participant