-
Notifications
You must be signed in to change notification settings - Fork 58
Making validation trigger on 'blur' optional #76
Comments
People seem to forget that you could also use interpolation to create/remove validation dynamically or use the Service to build validation dynamically as well. I can look in adding a global option but it won't be |
Considering what I wrote before, please give some feedback before I make any changes in my library. If I modify any code, it would probably a global option like you wish, but the name would be different since I don't want people to think they can use any type of triggers. I would probably do something like this option Again consider what I wrote in my previous message, validation on the form would most be probably still be invalid, is that really what you want? Please give some feedback |
Well, all we wanted to achieve was this: function next(form) {
var vs = new validationService();
if (vs.checkFormValidity(form)) {
// proceed to another view
};
} The form argument is passed from child controller(s) which are loaded into ng-view as needed, something like below
However, the validation doesn't work as expected. Maybe there are collisions with ui-mask plugin internals but I was able to click Next button and proceed to another view quite often without any validation error popping out while ngModel value being "undefined" which is not empty string but shouldn't be considered a valid input here either. When we added regex validator rule |
I did some investigation and it took me some time to get your setup working. You should seriously build a Plunker if you want me to help you on the next time... For the second error, I found out that I was using I'd like to know, does your second problem with the |
The fix was pushed in latest release v1.4.11 |
'strValue is not defined' error when using `max` auto-detect validator.
Your plugin is great but there is one feature we miss a lot in our current project. It's a SPA (single page application) with many Angular views loaded dynamically as user fills out forms (usually one form per screen). We need to trigger the validation only after Submit/Next button was clicked. I was able to "disable" on-the-fly validation as user types in the fields by setting
debounce
to insanely high value of 24 hours and also commented out lines 94 & 359 in validation-directive.jselm.bind('blur', blurHandler);
However, I'm not sure if my above hack is enough to achieve what was intended i.e. disable validation from being triggered when input field got 'blur' event. Would you be so kind to implement new option in global options, maybe something like {
trigger
: null } when validation should not trigger on any input event whereas default value would be {trigger
: 'blur' } which means that 'blur' event handler should be attached as a trigger event for validation to fire. Also, settingdebounce
to http://www.w3schools.com/jsref/jsref_infinity.asp could effectively disable validate-as-user-types feature but that's a minor issue for now.Thank you very much for your attention and continuous support to this project.
The text was updated successfully, but these errors were encountered: