Topic: Reset Form Validation
sandor farkas priority asked 9 months ago
Expected behavior I want to be able to reset the form validation errors.
document.getElementById('product-form').reset() is removing the elements but not the current validation errors.
Removing was-validated class from form has bad side effects.
Resources (screenshots, code snippets etc.) https://mdbootstrap.com/docs/b5/react/forms/validation
document.getElementById('product-form').reset() works just fine now!
@Wojciech Staniszewski It seems nothing has changed regarding my mentioned problem, right? I can't find anything related to a reset in the docs.
We are preparing huge changes in the MDBValidation component. The reset option will be also included. It should be released on March 21.
Here the snippet: https://mdbootstrap.com/snippets/react/sandorfarkas/3745608#js-tab-view
- submit the form
- reset the form
- you'll see that the error message will stay
- removing "was-validated" class leads to not validating the form anymore
What would be the right solution for the resetForm method?
isValidated property and
form.reset() at the same time. Could you also provide a simple project or code that demonstrates these side effects? If there's something we can improve we'll try to do that :)
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Priority
- Premium support: Yes
- Technology: MDB React
- MDB Version: MDB5 2.4.0
- Device: desktop
- Browser: chrome
- OS: windows 11
- Provided sample code: No
- Provided link: Yes