react-formal | Sophisticated HTML form management for React | Form library
kandi X-RAY | react-formal Summary
kandi X-RAY | react-formal Summary
Sophisticated HTML form management for React
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of react-formal
react-formal Key Features
react-formal Examples and Code Snippets
Community Discussions
Trending Discussions on react-formal
QUESTION
I'm very new to React and I'm really struggling to "reset" a form after a successful AJAX submission. Please note, no Redux. The values/set do not reset to empty after submission and the button (which I want to disable after a successful submission) does not get disabled either.
I'm using React-Formal for validation, and that is perhaps breaking the usual "onSubmit" behavior for the form, due to the Form using a custom
I've tried binding a
.bind(this)
to the AJAX form and disable the inputs and button with a this.setState
object, setting all the inputs to value : ''
and disabled: true
for the button and similar methods, but React does not recognize the setState
function inside AJAX function, even if I call another function inside the success that is outside of the AJAX scope.
Please note that I set individual onChange
behaviors for every input, as setting a one-for-all function would not work, probably because of the validation.
I'd really appreciate if you could help me out, as I've been struggling with this for days and nothing seems to work. I'd like to use React, but I'll have to disable the button with JQuery if it doesn't work, something which I'd like to avoid.
Thanks for your help! Here is the code:
...ANSWER
Answered 2017-May-29 at 10:43You did not bind the ajax success method where you are actually resetting the inputs
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-formal
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page