Skip to content

[Bug]: Resetting JSON Form creates an empty Array item for Array fields defaulted to [], causing validation failure #41653

@pboehm

Description

@pboehm

Is there an existing issue for this?

  • I have searched the existing issues

Description

When a JSON Form contains an Array field whose default value is an empty array ([]), resetting the form creates a new empty Array item unexpectedly.

If validation is enabled on that Array field, the form becomes invalid immediately after reset, even though the reset should restore the original default state. This prevents the form from being submitted.

Steps To Reproduce

  1. Create a new App and a JSON Form
  2. Specify {{ {profileIds: []} }} as source data in JS mode (real datasources have the same behaviour)
  3. Switch the Field configuration for Profile Ids to Field Type Array
  4. Configure the Field configuration for the Array Item to be Required and also specify a regex for validation like ^[a-z0-9-_]+$
  5. Now the form has no array item and is submittable
Image
  1. Click on Reset
  2. An empty array item appears and the form can not be submitted anymore, because the empty array item is not valid
Image

Public Sample App

No response

Environment

Production

Severity

High (Blocker to building or releasing)

Issue video log

No response

Version

Self Hosted - 1.95

Metadata

Metadata

Labels

BugSomething isn't workingNeeds TriagingNeeds attention from maintainers to triage

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions