Skip to content

Bugfix/FOUR-32292-b: Validation of required fields does not work correctly in Record List controls with checkboxes - #1938

Open
CarliPinell wants to merge 3 commits into
developfrom
bugfix/FOUR-32292-b
Open

Bugfix/FOUR-32292-b: Validation of required fields does not work correctly in Record List controls with checkboxes#1938
CarliPinell wants to merge 3 commits into
developfrom
bugfix/FOUR-32292-b

Conversation

@CarliPinell

Copy link
Copy Markdown
Contributor

Solution

Problems addressed

  • Required Record Form fields were not validated correctly on parent Submit (values live in list rows, not at root).
  • Add/Edit modal renderers polluted global valid/submitted state, so empty modal defaults could block parent Submit.
  • Error message double-counted the same controls (vdata + schema / vocabularies → e.g. 4 fields → “8 validation errors”).
  • PageNavigate on the Record Form page (e.g. “back to page 0”) pulled the main page into Record List row rules, creating ghost listName__* keys and inflating counts further (e.g. 10 vs 6).

Expected behavior after fix

  • N required checkboxes (root + Record Form) → about N errors when invalid (not 2×N).
  • Screens with PageNavigate on the Record Form page no longer inflate the count.
  • Modal Add/Edit still validates locally; parent Submit validates list rows correctly.

How to Test

Follow steps detailed in ticket

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

ci:deploy

@cypress

cypress Bot commented Sep 8, 2026

Copy link
Copy Markdown

screen-builder    Run #2507

Run Properties:  status check failed Failed #2507  •  git commit 64d1bb0c20: Bugfix/FOUR-32292-b: Validation of required fields does not work correctly in Re...
Project screen-builder
Branch Review bugfix/FOUR-32292-b
Run status status check failed Failed #2507
Run duration 42m 49s
Commit git commit 64d1bb0c20: Bugfix/FOUR-32292-b: Validation of required fields does not work correctly in Re...
Committer CarliPinell
View all properties for this run ↗︎

Test results
Tests that failed  Failures 2
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 19
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 391
View all changes introduced in this branch ↗︎

Tests for review

Failed  Loop.spec.js • 1 failed test • CI - Chrome

View Output

Test Artifacts
Loop control > Verify validation on visible fields Test Replay Screenshots
Failed  DefaultValues.spec.js • 1 failed test • CI - Chrome

View Output

Test Artifacts
Default values > Javascript default value Test Replay Screenshots

@nolanpro

nolanpro commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-016a15d52c.engk8s.processmaker.net

@nolanpro

nolanpro commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

QA server K8S was successfully deployed https://ci-016a15d52c.engk8s.processmaker.net

@eiresendez eiresendez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manual testing confirms that the reported scenario is fixed 👍 I'm just leaving a few observations:

  1. Remove first-row-dependent conditional validation
  2. Clarify empty-list semantics

Comment thread src/ValidationsFactory.js

const rowRules = {};
const rows = get(this.data, listName);
const firstRow = (Array.isArray(rows) && rows.length > 0) ? rows[0] : {};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴

  • src/ValidationsFactory.js:409 — Record Form validation rules depend on the first row’s visibility state.
    • The rule tree is constructed using firstRow. FormElementValidations.isVisible() can therefore omit a conditionally visible required field when it is hidden in the first row.
    • If that field is visible and invalid in a later row, no rule exists to validate it and the parent form can submit invalid data.
    • Build the validation rules independently of one representative row, while evaluating conditional visibility separately for every row during validation.
Screen.Recording.2026-09-08.at.5.06.26.p.m.mov

Comment thread src/ValidationsFactory.js
const data = props[1];
const listRows = get(data, listName);
// No rows yet: treat as empty field values (required/accepted fail).
if (!Array.isArray(listRows) || listRows.length === 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 The PR makes an empty Record List fail once for every required field in its Record Form. This behavior is explicitly covered by the new unit test, but it is outside the expected behavior of FOUR-32292.

@CarliPinell Could you confirm whether required fields inside the Record Form are also intended to require at least one row? Otherwise, this changes the previous behavior and may make existing screens with an optional empty Record List invalid.

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.

3 participants