vendredi 9 septembre 2016

Ember validation firing too late

I am using Ember 1.7 and have a model with a validation on it.

Using the input helper, I'm binding an action to the on="key-press" trigger.

In the action fired (within my controller) I'm calling this.get('myModalInstance').validate() and I have handlers setup for pass and fail.

What's odd is that the validation seems to fire with the previous value I've typed.

So if my validation says numericality: { greaterThan: 0, lessThanOrEqualTo: 90 } when I type 9, it validates ok, when I type in 91 it validates ok, and when I type in 911 it fails validation.

This seems one key press too late as far as I can see. Is this a known / common issue? Are there are tips for avoiding this issue?




Aucun commentaire:

Enregistrer un commentaire