0

I have a form inside a modal, that form allows user to update each model feild and I'm also using ember-validations to validate them, but then after successful saving or when a user closes/cancel the modal the form element still contain the class has-success, has-error, has-feedback classes, so how can I reset the form fields after every successful saving/cancel?

r-r
  • 307
  • 2
  • 15

1 Answers1

0

It's common practice create new Form instance instead of cleaning errors. For each opening form/modal you should create new form

  form: computed(function() {
    return Form.create({    });
  }),
  actions: {
     onShow() {
       this.notifyPropertyChange('form');
     }
  }
Vasiliy vvscode Vanchuk
  • 7,007
  • 2
  • 21
  • 44