When Use SubmitError . Input Field is Invalid Forever. in 'React' Final Form
See original GitHub issuewhen i use
<button type="submit" disabled={invalid}>
and use submitError
const onSubmit = async values => {
if (values.username !== "erikras") {
return { username: "Unknown username" };
}
Meta in Username is set Invalid:true When OnChange Username Input it not change meta.invalid
submit button so can’t click anymore.
// but i can hide submitError by meta.dirtySinceLastSubmit
{(meta.error ||
(meta.submitError && !meta.dirtySinceLastSubmit)) &&
meta.touched && <span>{meta.error || meta.submitError}</span>}
Sandbox Link
Issue Analytics
- State:
- Created 5 years ago
- Reactions:12
- Comments:19 (2 by maintainers)
Top Results From Across the Web
Final Form Docs – `FormState`
An object full of booleans, with a value of true for each dirty field. ... For example, if your form is invalid because...
Read more >Can a field in react-final-form mark itself as invalid / prevent ...
When the file is uploading, it renders a field that will always be invalid, thus blocking the submission.
Read more >how to remove the submiterror if the user write another thing ...
When Use SubmitError . Input Field is Invalid Forever. in 'React' Final ... Github.com > final-form > react-final-form. to allow the form ...
Read more >react-final-form - Bountysource
When Use SubmitError . Input Field is Invalid Forever. in 'React' Final Form $ 0. Created 3 years ago in final-form/react-final-form with 19...
Read more >react-final-form-kt - npm
The name of the field. input.onBlur: (?SyntheticFocusEvent<*>) => void. The onBlur function can take a SyntheticFocusEvent like ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For anyone landing here, I have made a simple helper for clearing the errors after submit. https://github.com/ignatevdev/final-form-submit-errors
It basically listens for changes in your form and tries to detect if any of the errors in your
submitErrors
object corresponds to the changed field.If it does - it clears the error and also removes the path of an error, if necessary, to avoid empty objects and arrays for deep fields.
The library is quite raw and not battle tested yet, but if anyone wants to try it out and give a feedback - you are welcome.
Guys, this works: