Cannot easily pass errors from outside the form into it
See original GitHub issueI have a form that will have some validation errors coming from the parent component. I need to take those errors and pass them to the form state. However, informed doesn’t seem to provide such functionality. I could do it via setError
function, but I would like to be able to achieve that without having to convert my components to stateful components. Is there such a way?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
passing form errors from outside · Issue #33 · jaredpalmer/formik
Hi :) What's the best way to pass the errors from outside? What I'm trying to do is to get network errors from...
Read more >How to display <form:errors> outside <form:form> in Spring?
Show activity on this post. I'm new to Spring and I've been having some trouble trying to show a form errors. The form,...
Read more >Form Validation Errors - how to track them and what to do ...
1) a user entered an invalid data into a form field, for example, an email without "@" character; 2) a user entered a...
Read more >Custom field validation with errors outside of JSONForms and ...
Hi, I'd like to run some custom validation logic for a field in my JSONForms form. If this logic finds a problem, it...
Read more >How to Report Errors in Forms: 10 Design Guidelines
Help users recover from errors by clearly identifying the problems and allowing users to access and correct erroneous fields easily.
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
I’m a big fan of stateless components, so here’s what I try to do:
When I tried this approach, I realized that it causes the state to be updated inside the render function which causes it to re-render and update state again, ie endless loop.
I could technically convert it to a stateful component and use
componentWillReceiveProps
, but I’d rather avoid that. I would propose instead a prop, something likeerrors
on bothForm
andField
component that would take an error object and merge it with validation errors. Something like this:Not sure if it’s functionality that others would be interested in, but it probably wouldn’t hurt. I can put together a PR for that.
Closing as V2 is out and this should work as expected