aurelia / validation

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

Have validation work with inbrowser capabilities (if present) #15

Closed Alxandr closed 8 years ago

Alxandr commented 9 years ago

Discussion

TLDR:

http://yolodev.github.io/mimosa-aurelia-skeleton/#blog/login <- take a look at this (in chrome) And just hit "login" without typing anything in the inputs That's handled strictly by the browser And it's extensible So you can get your own error messages There is no js that makes that happen And the experience is awesome

Also:

Which also, at the same time, prevents the form from being submitted

janvanderhaegen commented 9 years ago

Hy @Alxandr, thanks for the feedback and the great idea. Would you say I'm correct that there are really two requests in your issue: a) when working with a validation 'model', it should add the inbrowser capabilities where possible (isRequired, etc) (we'll keep this issue for it) b) it should be possible to declare your validation in the view completely, by adding inbrowser capabilities and custom elements (see #7 )

About adding the inbrowser capabilities, would it be possible to provide some extra feedback about what type of inbrowser capabilities we might add, how you feel it's extensible and how we could get our own error messages to show up?

Thanks Jan

Alxandr commented 9 years ago

My PC just died so I'm writing this on the phone. apologize for any errors that might occur from this.

There are at least two aspects to the seashore, I should have described. the first one, is reading attributes such as required from the DOM, and automatically applying validations to those elements. This would allow browsers that does not support this natively , to support them nonetheless. Basically a polyfill kind of deal.

the second part of this issue, is to make sure that whenever there is an issue with the validation, it is reported to the validation model of the DOM. this is done by simply setting a string property on the input elements if I recall correctly.

the issue however, is that this has to be done whenever the values change. Is not enough to do this on call backs such as onsubmit. the beauty about these errors, is that they will actively prevent any forms from being submitted that contains errors.

plwalters commented 8 years ago

Thanks for submitting this / commenting on this. At this time we are closing this because we have completely re-written and are deprecating the previous feature set. If you feel this should be re-opened please feel free to review this blog post and submit either again on this repository, or on the new validatejs bridge repository

Thanks again!