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

Validation on controller level #18

Closed jelhan closed 10 years ago

jelhan commented 10 years ago

Support for validation on controller level would be really nice. Yet validation is only supported on model level.

I have a multistep wizard to enter data for just one model. I need to validate on each step if the data required in this step is provided. Validation on model level does not work for this because it fails on first steps because of data which should be entered later.

I had a short overview in code of ember-forms. Validation is bind to model at several points:

asaf commented 10 years ago

There is no problem to put validations on the controller level,

Just pass {{form model=controller}} and make sure your controller has isValid property.

jelhan commented 10 years ago

Changing to {{form model=controller}} works. Thank you for your help. I wrote a JSBin for testing. Perhaps it's helpfull for other people with similar problems: http://emberjs.jsbin.com/hocahivo/12/edit