Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with omit extra data and live omit not working onSubmit #4187

Open
1 task done
AayushB opened this issue May 7, 2024 · 1 comment
Open
1 task done

Issue with omit extra data and live omit not working onSubmit #4187

AayushB opened this issue May 7, 2024 · 1 comment
Labels
duplicate issue This issue is a duplicate of another one question

Comments

@AayushB
Copy link

AayushB commented May 7, 2024

Prerequisites

What theme are you using?

bootstrap-4

What is your question?

I'm encountering an issue with the React JSON Form library where omit and liveOmit functionality seems to be working only on onChange but not on onSubmit, particularly when the user proceeds to submit the form without making any changes. When I use omit or liveOmit to exclude certain fields from the form submission, it behaves as expected during user interaction (onChange), but the omitted fields still get submitted when the form is submitted (onSubmit) without any user modifications.

Is there a known workaround or configuration setting to ensure that omitted fields are also excluded from the final form submission (onSubmit) in cases where the user hasn't made any changes? Alternatively, is there a recommended approach to achieve omitting fields specifically on form submission?

Here's how you can replicate the issue in react playground:

  1. Navigate to the React JSON Form playground.
  2. In the JSON schema, add a field called "foo" with a default value of "bar".
  3. Check the "Omit extra data" and "Live omit" options.
  4. Observe that the "foo" field is included in the form.
  5. Without making any changes to the form fields, click the "Submit" button.
  6. Notice that despite the "Omit extra data" and "Live omit" options being checked, the "foo" field is still included in the submitted data.
  7. If you now make any changes to the form, foo should get removed.

Any insights or guidance on resolving this issue would be greatly appreciated!

@AayushB AayushB added needs triage Initial label given, to be assigned correct labels and assigned question labels May 7, 2024
@heath-freenome
Copy link
Member

@AayushB This may be a duplicate of #4109. I know that there are several people possibly working on a solution to that bug.

@heath-freenome heath-freenome added possibly close To confirm if this issue can be closed duplicate issue This issue is a duplicate of another one and removed needs triage Initial label given, to be assigned correct labels and assigned labels May 17, 2024
@stale stale bot removed the possibly close To confirm if this issue can be closed label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate issue This issue is a duplicate of another one question
Projects
None yet
Development

No branches or pull requests

2 participants