aurelia / validation

A validation plugin for Aurelia.
MIT License
132 stars 128 forks source link

Configure default validation trigger #535

Closed RomkeVdMeulen closed 4 years ago

RomkeVdMeulen commented 5 years ago

I'm submitting a feature request

Current behavior: By default validation is triggered onChange and onBlur, according to the docs (although the ValidationController sets the trigger to blur by default: is the doc out of date?). These default triggers are baked in and can only be overridden case by case by using a different binding behavior or changing the ValidationController's validateTrigger after injection.

Expected/desired behavior: I'd like to be able to specify the default validation triggers for my entire app rather than on an individual binding level.

What is the motivation / use case for changing the behavior? After reading that validating input as the user types, or on blur, can be problematic I tried to switch all validation in my app at once to only validate on submit. So far as I can tell, the only way to achieve this is to replace each & validate binding behavior with & validateOnBlur or to set each ValidationController's validateTrigger to manual after injection. I'd like to be able to configure this once at plugin registration.

bigopon commented 5 years ago

@RomkeVdMeulen This feature sounds nice, and doesn't sound hard to achieve. Wanna give it a go? Would be awesome if we could have some help ❤️

RomkeVdMeulen commented 5 years ago

I'd love to, but I'm a bit swamped and I have a project next week, so it won't be before the 14th.

RomkeVdMeulen commented 5 years ago

@bigopon Could you take a look at the PR? I think it should be ready to be merged in.