I am wondering if the form validation with Safari Browser (MAC OS and Version 7.0.4 (9537.76.4)) when using input type="number" is not working properly:
When visiting
http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_max_min
with Safari Browser I expect that I would get a warning when I enter a letter or a number outside the specified range into the "Quantity" field. But nothing happens and the input is sent to the server...
When using Chrome I get a warning...
I also have checked the http://html5test.com site and it states that the input type number and the min and max attribute are supported. But why then is it not working?? What am I doing wrong or what am I not understanding?
Any help greatly appreciated...
Thanks Tobi
Edited: As Frank Conijn mentions it is not really working with Safari. I now solved it with Javascript (Check all number input fields if they contain a number and if it is within the specified bounds):
$("input[type='number']").change(function(){
var maxValue = parseInt($(this).attr('max'));
var minValue = parseInt($(this).attr('min'));
var enteredValue = parseInt($(this).val());
if($.isNumeric(enteredValue)) {
var enteredValue = parseInt($(this).val());
if (enteredValue > maxValue) {
$(this).val(maxValue);
} else if (enteredValue < minValue) {
$(this).val(minValue);
}
} else {
$(this).val(minValue);
}
});