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

Programmatic submit does not work properly in Firefox #3121

Open
4 tasks done
nickgros opened this issue Sep 16, 2022 · 9 comments
Open
4 tasks done

Programmatic submit does not work properly in Firefox #3121

nickgros opened this issue Sep 16, 2022 · 9 comments
Assignees
Labels

Comments

@nickgros
Copy link
Contributor

Prerequisites

What theme are you using?

core

Version

5.0.0-beta6

Current Behavior

When using Firefox programmatic submit ends up embedding a copy of the entire page into the rendered form

image

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@nickgros nickgros added bug needs triage Initial label given, to be assigned correct labels and assigned labels Sep 16, 2022
@heath-freenome
Copy link
Member

@jacqueswho Do you have time to take a look at this?

@jacqueswho
Copy link
Contributor

ill take a look

@heath-freenome heath-freenome removed the needs triage Initial label given, to be assigned correct labels and assigned label Sep 29, 2022
@saswat3115
Copy link

I also faced same issue. Want programmatically submit as we ll as validating forms also

@nickgros
Copy link
Contributor Author

nickgros commented Jun 1, 2023

Workaround: it seems instead of calling ref.current.submit() as in the docs, you can do ref.current.formElement.current.requestSubmit()

@emielvanseveren
Copy link

emielvanseveren commented Jun 22, 2023

Workaround: it seems instead of calling ref.current.submit() as in the docs, you can do ref.current.formElement.current.requestSubmit()

Can confirm, this works. Might want to add this to the docs (temporarily).

I looked a bit further into this. And I think (not tested) it has something to do with the dispatched event not being the same event as the actual formSubmitEvent. So when adding e.g. e.preventDefault() in the onSubmitHandler it is trying to stop the formSubmit event and not the custom dispatched event.

I don't have the time to test this, but one could try to add a customEvent.preventDefault() closely after the dispatch and see if it still occurs.

@snlamm
Copy link

snlamm commented Jun 26, 2023

I looked a bit further into this. And I think (not tested) it has something to do with the dispatched event not being the same event as the actual formSubmitEvent. So when adding e.g. e.preventDefault() in the onSubmitHandler it is trying to stop the formSubmit event and not the custom dispatched event.

Also ran into this issue - though in Chrome - where it was causing the onSubmit function to be called twice.
Fortunately, the ref.current.formElement.current.requestSubmit() workaround helps 👍 .

@hirenr
Copy link

hirenr commented Dec 26, 2023

I can confirm this does not work on Safari. I can see the issue in the playground also.

It seems

requestSubmit

is not supported in Safari at all. So the above workaround also is not working!

abdalla-rko pushed a commit to abdalla-rko/react-jsonschema-form that referenced this issue Apr 2, 2024
heath-freenome added a commit that referenced this issue Apr 5, 2024
Co-authored-by: Abdallah Al-Soqatri <abdallah.al-soqatri@aspentech.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
@jeremy-marcus
Copy link

With the merge of #4150, is this issue now closed?

@heath-freenome
Copy link
Member

@jeremy-marcus It most likely is. @nickgros would you be willing to confirm this and close it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants