5.3.3: Clear submit errors on field change?
See original GitHub issueThanks for this great library!
Is there a way to clear the form-level submit error when field data changes?
The submit error no longer applies once the user has changed their entry, so I want to stop showing it to the user until they’ve tried submitting again. I haven’t been able to find out how to do that.
Note, this code might be slightly off since I edited it for posting here, but any fix that would work for this would work for my site code.
Sample container code:
function mapDispatchToProps(dispatch, ownProps)
{
return {
mySubmitHandler: (values) =>{
return dispatch(asyncSubmit(values.name, values.email))
.catch(err=>{
return Promise.reject({_error: err.message});
});
}
};
}
Sample component code:
const RegistrationDialog = (props) => {
const { fields: {name, email},
handleSubmit,
mySubmitHandler,
submitting,
error } = props;
return (
<form onSubmit={ handleSubmit((values)=>{return mySubmitHandler(values)}) }>
<input type="text" {...name}/>
<input type="text" {...email}/>
{ error && <ErrorMessageView message={ error }/> }
<button>Submit</button>
</form>
);
Alternatively, is there a property to check whether any field data has changed since the submit error happened, that I can use to hide the error message component?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
Redux-form v5: How to clear/hide submit error after field edited
redux-form.com/5.3.3/#/api/props) However, I'm not seeing the submit error cleared when changing a field value. Using 5.3.3. Is it possible that that behavior ...
Read more >5.3.3. Error Code Recovery - Intel
Possible error recovery steps: For QSPI operation: Send command with a valid chip select. Send command with a valid QSPI flash address. For...
Read more >useForm - ClearErrors - React Hook Form
This function can manually clear errors in the form. Props. Type, Description, Example. undefined, Remove all errors. clearErrors().
Read more >HTML 5.2: 4.10. Forms - W3C
A form is a component of a Web page that has form controls, such as text fields, buttons, checkboxes, range controls, or color...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
In addition, all of the validation errors and request input will ... an error message that is located in your application's lang/en/validation.php file....
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 FreeTop 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
Top GitHub Comments
In 7.1.2 there’s a
clearSubmitErrors
action creator that you can call in theonChange
handler for your form:@Didericis that doesn’t seem to do anything for me as my component i have rendered under a props.submitFailed condition doesnt disappear