Skip to content

Values Not Resetting on Change of Dependent Field in RJSF Form #4337

@reshmarevi-kv

Description

@reshmarevi-kv

Prerequisites

What theme are you using?

core

Version

5.21.2

Current Behavior

we have a schema utilizing oneOf under dependencies to conditionally display fields based on the value selected in a primary field. However, when a user changes the value of the primary field, the values in the subsequent fields do not reset to their default state.

Expected Behavior

Upon changing the value of "Do you have any pets?", all dependent fields should reset to their default values, removing any previously entered data.

Steps To Reproduce

https://codesandbox.io/p/sandbox/jgpnnz

Select "Yes: One" from the "Do you have any pets?" dropdown and enter a value for "How old is your pet?".
Change the selection back to "No".
Then, switch to "Yes: More than one". the value i previously entered is still there.

when I consoled the formdata, what I found is the entered value always persisting..this causing lot of issues when there is chained dependencies.

Environment

- OS:
- Node:
- npm:

Anything else?

need a immediate fix for this

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds triageInitial label given, to be assigned correct labels and assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions