You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when form is first initialized formData is {increment: {}} and when I change to reset formData is set to {increment: undefined, reset: {}} and again when change to increment formData is {increment: undefined, reset: undefined}
Expected Behavior
When changing back to option increment It should be {increment: {}} not {increment: undefined, reset: undefined}
altpd13
changed the title
<title> Switching between two oneOf option returns undefined form data
Switching between two oneOf option returns undefined form data
Sep 26, 2024
Thank you @nickgros for reading my issue
But I'm afraid the behavior #3711 is different from my behavior.
The current behavior I've mentioned is when changing back to oneOf element which requires empty object property results undefined value.
So for example I want a formData that have empty value(e.g {increment: {}} on submit. The initial formData when Form first renders is set as exactly what I wanted it to be({increment: {}}). But changing to other oneOf element and changing back to increment element will set the formData to {increment: undefined, reset: undefined} not {increment: {}, reset: undefined}.
I wish this information would helps you understand
Prerequisites
What theme are you using?
core
Version
5.2.0
Current Behavior
Using this json Schema
when form is first initialized formData is
{increment: {}}
and when I change toreset
formData is set to{increment: undefined, reset: {}}
and again when change toincrement
formData is{increment: undefined, reset: undefined}
Expected Behavior
When changing back to option
increment
It should be{increment: {}}
not{increment: undefined, reset: undefined}
Steps To Reproduce
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJyZXNldCI6e319LCJzY2hlbWEiOnsiJHNjaGVtYSI6Imh0dHA6Ly9qc29uLXNjaGVtYS5vcmcvZHJhZnQtMDcvc2NoZW1hIyIsInRpdGxlIjoiRXhlY3V0ZU1zZyIsIm9uZU9mIjpbeyJ0eXBlIjoib2JqZWN0IiwicmVxdWlyZWQiOlsiaW5jcmVtZW50Il0sInByb3BlcnRpZXMiOnsiaW5jcmVtZW50Ijp7InR5cGUiOiJvYmplY3QifX0sImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjpmYWxzZX0seyJ0eXBlIjoib2JqZWN0IiwicmVxdWlyZWQiOlsicmVzZXQiXSwicHJvcGVydGllcyI6eyJyZXNldCI6eyJ0eXBlIjoib2JqZWN0IiwicmVxdWlyZWQiOlsiY291bnQiXSwicHJvcGVydGllcyI6eyJjb3VudCI6eyJ0eXBlIjoiaW50ZWdlciIsImZvcm1hdCI6ImludDMyIn19fX0sImFkZGl0aW9uYWxQcm9wZXJ0aWVzIjpmYWxzZX1dfSwidWlTY2hlbWEiOnt9LCJ0aGVtZSI6ImRlZmF1bHQiLCJsaXZlU2V0dGluZ3MiOnsic2hvd0Vycm9yTGlzdCI6InRvcCIsImV4cGVyaW1lbnRhbF9kZWZhdWx0Rm9ybVN0YXRlQmVoYXZpb3IiOnsiYXJyYXlNaW5JdGVtcyI6eyJwb3B1bGF0ZSI6InBvcHVsYXRlIiwibWVyZ2VFeHRyYURlZmF1bHRzIjpmYWxzZX0sImFsbE9mIjoic2tpcERlZmF1bHRzIiwiZW1wdHlPYmplY3RGaWVsZHMiOiJwb3B1bGF0ZUFsbERlZmF1bHRzIn0sImxpdmVWYWxpZGF0ZSI6ZmFsc2V9fQ==
Environment
Anything else?
No response
The text was updated successfully, but these errors were encountered: