-
-
Couldn't load subscription status.
- Fork 257
[form][field] Add 'onSubmit' validation mode
#3013
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
Conversation
commit: |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
63c6d89 to
2d56111
Compare
| * Asynchronous functions are supported, but they do not prevent form submission | ||
| * when using `validationMode="onSubmit"`. |
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.
Not sure if it's a good idea to try to handle it, but its different from the native behavior anyway so I think we could just ignore and only document it for now, what do you think? @atomiks
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.
I don't think it's possible to support it given event.preventDefault() needs to be sync, it makes sense to document it here
2d56111 to
7653f15
Compare
7653f15 to
443266f
Compare
e744eca to
730ccd2
Compare
|
Needs #3048 |
730ccd2 to
ec66468
Compare
ec66468 to
b19ec4a
Compare
b19ec4a to
090a2ac
Compare
090a2ac to
7eff286
Compare
ccf5a57 to
4339422
Compare
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.
Nice~ matching RHF is a good default
Breaking:
<Field>'s defaultvalidationModeis now'onSubmit'.validationModecan be set on<Form>to configure all child<Field>svalidationMode: 'onSubmit'runs validations when the<Form>is first submitted, afterwards fields are re-validated on change.This mode matches native form submission behavior and the defaults of RA, Ariakit and react-hook-form.
Can be tested in the forms experiment though it's mostly
requiredvalidationsCloses #2142