validate only on focusOut or submit
This commit is contained in:
parent
f766e169bd
commit
2e742ea903
7 changed files with 39 additions and 8 deletions
|
@ -8,6 +8,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
submit: function(){
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
this.send('save');
|
||||
}
|
||||
|
|
|
@ -8,6 +8,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
submit: function(){
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
this.send('save');
|
||||
}
|
||||
|
|
|
@ -88,6 +88,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
submit: function(){
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
// tricker save action
|
||||
this.send('save');
|
||||
|
|
|
@ -36,6 +36,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
submit: function() {
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
// tricker save action
|
||||
this.send('save');
|
||||
|
|
|
@ -20,6 +20,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
submit: function() {
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
// tricker save action
|
||||
this.send('save');
|
||||
|
|
|
@ -50,6 +50,12 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
|
|||
|
||||
submitNewUser: function() {
|
||||
this.validate();
|
||||
|
||||
$.each(Ember.View.views, function(id, view) {
|
||||
if(view.isEasyForm) {
|
||||
view.focusOut();
|
||||
}
|
||||
});
|
||||
|
||||
if (this.get('isValid')) {
|
||||
// tricker save action
|
||||
|
|
|
@ -7,14 +7,7 @@ export default {
|
|||
initialize: function() {
|
||||
|
||||
Ember.EasyForm.Input.reopen({
|
||||
errorsChanged: function() {
|
||||
this.set('hasFocusedOut', true);
|
||||
this.showValidationError();
|
||||
},
|
||||
classNameBindings: ['wrapperConfig.inputClass', 'wrapperErrorClass'],
|
||||
didInsertElement: function() {
|
||||
this.addObserver('context.errors.' + this.property + '.@each', this, 'errorsChanged');
|
||||
},
|
||||
isCheckbox: function() {
|
||||
if (this.get('inputOptionsValues.as') === 'checkbox') {
|
||||
return true;
|
||||
|
@ -30,7 +23,9 @@ export default {
|
|||
else {
|
||||
return '';
|
||||
}
|
||||
}.property('inputOptionsValues')
|
||||
}.property('inputOptionsValues'),
|
||||
|
||||
isEasyForm: true
|
||||
});
|
||||
|
||||
Ember.EasyForm.Error.reopen({
|
||||
|
|
Loading…
Reference in a new issue