backbone-forms icon indicating copy to clipboard operation
backbone-forms copied to clipboard

HTML5 validation for the input control

Open akoval opened this issue 8 years ago • 4 comments

Numeric input control can be invalid (for example<input type=number> with 123....456 text). but validation mechanism returns OK.

It uses this.$el.val() which returns empty for invalid control. As a result all validators passed (except required validator). So for optional fields form will be always committed to server with incorrect input.

Maybe need to add some checking to verify control state? something like: this.$el.is(':invalid')

akoval avatar Mar 14 '16 13:03 akoval

This seems more like a roadmap thing to consider - making validation work with HTML5 elements. We should probably discuss this @exussum12 @powmedia ?

glenpike avatar Apr 01 '16 21:04 glenpike

Agreed, The support for these elements is pretty small currently. This should be supported though as the usage will rise

exussum12 avatar Apr 29 '16 18:04 exussum12

I've been using HTML5 validation more and more, it could be a good idea to at least use the same API and polyfill where required? Could use existing libraries for that.

On Fri, Apr 29, 2016 at 7:59 PM Scott Dutton [email protected] wrote:

Agreed, The support for these elements is pretty small currently. This should be supported though as the usage will rise

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/powmedia/backbone-forms/issues/499#issuecomment-215848778

powmedia avatar Apr 29 '16 19:04 powmedia

The support is actually very good these days (94% global support): http://caniuse.com/#search=validation

+1 for having an optional polyfill for the remaining browsers

philfreo avatar Apr 29 '16 21:04 philfreo