indexiatech / ember-forms

Smart, Intuitive forms for Ember.js styled with Bootstrap, Multi layouts and Validation support.
http://indexiatech.github.io/ember-forms
Apache License 2.0
218 stars 45 forks source link

reset form validation (style + message) #107

Closed ghost closed 9 years ago

ghost commented 9 years ago

Excellent library. I'm wondering if there is a way to reset the form validation. I've tried a few things based on the source code, setting the "this.set('errors.field_name', [])" to no avail.

When I enter the route, the controller has multiple properties that work with the form. At this point, there is no initial validation feedback.

I have a case where after save, I need to clear the values. This is because I'm not transitioning after save, but staying on the same route.

For validation, the values must be present (presence set to "true").

However, if I clear the values I would like the form to go back to its initial state without the validation feedback. (styling + message). And this would restart the process again upon saving.

Thanks for any feedback.

ghost commented 9 years ago

targetting "canShowErrors" solved it, thanks.

prasannatm commented 9 years ago

Hi, Good library. If there is a document for how to reset the form in ember, please let me know..

Right now i am using

$('form').find("input, textarea, select").val("");

Thanks.