Skip to content

Improve Save Template validation when no fields are selected#1148

Merged
labkey-martyp merged 1 commit into
release26.3-SNAPSHOTfrom
26.3_fb_ehr_save_template_no_fields
Jun 15, 2026
Merged

Improve Save Template validation when no fields are selected#1148
labkey-martyp merged 1 commit into
release26.3-SNAPSHOTfrom
26.3_fb_ehr_save_template_no_fields

Conversation

@labkey-martyp

Copy link
Copy Markdown
Contributor

Rationale

Submitting the EHR "Save As Template" dialog with every field unchecked threw an uncaught TypeError: Cannot read properties of undefined (reading 'length'). The checkboxgroup's getValue().fields is undefined when nothing is selected, so reading .length crashed onSubmit — the user got a silent failure (the template was never saved) plus a console error, instead of any guidance.

Related Pull Requests

None.

Changes

  • Guard the selected-field list before reading .length, so an empty selection no longer throws.
  • Evaluate the record-selector 'none' case before the field check, so a section the user intends to save is distinguished from one explicitly excluded.
  • When no fields are selected, show a clear validation message ("At least one field is required and none are selected. Note: The field can be blank.") instead of the generic "No records selected" alert.

Submitting the EHR Save As Template dialog with every field unchecked threw an uncaught TypeError because the checkboxgroup's getValue().fields is undefined when nothing is selected, leaving the user with a silent failure and a console error. Guard the field list before reading its length, and check the record selector for 'none' first so a section the user intends to save is distinguished from one explicitly excluded. When no fields are selected, show a clear validation message instead of the generic "No records selected" alert.
@labkey-martyp labkey-martyp merged commit bb2d0ea into release26.3-SNAPSHOT Jun 15, 2026
8 of 9 checks passed
@labkey-martyp labkey-martyp deleted the 26.3_fb_ehr_save_template_no_fields branch June 15, 2026 11:51
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.

2 participants