-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add onSubmit to form #589
Add onSubmit to form #589
Conversation
Make sure they aren't filtered out On all of our Form examples, preventDefault so that we don't redirect Not sure if i should make preventDefault a default setting though...
Build successful! 🎉 |
Build successful! 🎉 |
# Conflicts: # packages/@react-types/form/src/index.d.ts
Build successful! 🎉 |
Build successful! 🎉 |
# Conflicts: # packages/@react-spectrum/provider/docs/Provider.mdx # packages/@react-spectrum/provider/stories/Provider.stories.tsx
Build successful! 🎉 |
'target', | ||
'onSubmit', | ||
'onReset' | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add onKeyDown to this?
Any updates on when this will get released? |
Could you add onKeyDown to the list of props. I use it to control weather enter triggers a submit. https://github.com/joepuzzo/informed/blob/548a4b9298172168688046f19a058cbe1ace268e/src/FormController.js#L517 Here is example https://joepuzzo.github.io/informed/?path=/story/hooks--useform |
@snowystinger can you please fix the conflict so this can be merged? Much appreciated. |
Hi @joepuzzo, thanks so much for your interest, this work isn't in our immediate sprints. This was really a bit of an exploration. If you'd like to contribute, we could help with that. |
@snowystinger Key down is for preventing the enter key from submitting the form. I already call preventDefault in the onSubmit. Also, this work seems to already be complete? It just needs to get merged into master and published. Any ideas when that may be as this prevents doing any form submissions. Thanks again for the awesome work. |
@joepuzzo You shouldn't need to do anything other than preventDefault in onSubmit https://www.w3schools.com/jsref/event_preventdefault.asp As for this PR, there are a lot of issues with onReset right now. You can try them out in different browsers in the stories that I modified specifically for this PR. If you don't need onReset, then we can can accept a smaller PR that just adds onSubmit |
Hmm what is the issue with onReset exactly? Yes on submit would get me mostly what I need. That would at least allow form submissions to work :) |
# Conflicts: # packages/@react-spectrum/provider/docs/Provider.mdx
…now, we can add it back in followup if anyone needs it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are failing
did more research, only get and post are valid form methods, other libraries hide this by accepting the others but actually submitting a post request enctype can truly only be three values, any custom ones will result in inconsistent behavior, if something else is needed, then js ajax must be used
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Build successful! 🎉 |
Thanks guys! What is your release cycle like? Do you release beta when you merge to master? |
Should be early next week. We're working on getting automated nightly builds set up as well so should be faster in the future. |
Any updates on beta releases? |
today or tomorrow hopefully |
Missing behavior from a forms onSubmit? What is the behavior? |
|
That bug already exists. I think it has to do with the button. Not the form |
Closes
Not adding onReset yet, there are too many differences between browsers and between controlled/uncontrolled elements within a form. We can consider onReset in the future if there is need.
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project: