Closed jelhan closed 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.
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
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:
init
ofEm.Forms.FormControlHelpComponent
,Em.Forms.HasPropertyMixin
andEm.Forms.HasPropertyValidationMixin
submit
action ofEmber.Forms.FormComponent
disabled
property ofEmber.Forms.FormSubmitComponent