Conversation
In case some of the form data properties is not an empty string (empty array, object...). This way it will really reset the form data.
|
Nice one @atorscho . I stumbled on this issue yesterday when I wanted to update a form (student info) in an app I'm building, meaning the form comes pre-populated with previously saved data (using the v-model directive in a vue component). Now in the middle of my editing, I realized I had also touched some fields I didn't initially intend to modify, and I didn't want to close the form, open it again and start editing from afresh. "No problem" I thought, I have my reset button, and it calls the form.reset() method; why not just click it? Oops! There's a problem after all: My form is now blank. My first instinct was to leave the form That being said, my greatest thanks go to @JeffreyWay . That's some great abstractions you've achieved and I've been using your Form.js and Errors.js classes since I followed your tutorials on @laracasts . It took me some time to wrap my brain around them, but it was worth it and I'm reaping the benefits now. Thanks a lot. |
In case some of the form data properties is not an empty string (empty array, object...). This way it will really reset the form data.