dsheiko / HTML5-Form-Shim

⛔️ [DEPRECATED] That is a jquery plugin, which emulates HTML5 Form Validation on old browsers. The plugin also allows to customize form submission validation tooltips and field validation callbacks (e.g. via XMLHttpRequest)
http://dsheiko.github.io/HTML5-Form-Shim/
71 stars 17 forks source link

input of type number bug #14

Closed jailengarcia closed 10 years ago

jailengarcia commented 10 years ago

Input of type number, fail with this value "45fff".

dsheiko commented 10 years ago

Just checked in the specs http://www.w3.org/TR/html-markup/input.number.html It deals with floating-point numbers, not hex/octal as far as I can see. So you what you can add your custom validator for a type. Something like:

$.setCustomInputTypeValidator( "Octal", "Please enter a valid octal number", function() {
        var pattern = /^[\da-f]+$/i;
        return !$( this ).val() || pattern.test( $( this ).val() );
});

Or with min/max as it is done for Number