Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE10 Validation bug with maxlength and placeholder on textbox

I have a textbox for Age:

<input type="text" id="txtAge" name="txtAge" class="text" placeholder="Age (optional)" maxlength="2">

Upon clicking submit, this input is instantly bordered red. There is no postback. I'm assuming IE10 believes the client has actually typed in "Age (optional)" which is greater than the maxlength of 2.

Is there anyway to get around this without making the user do anything in their browser's settings and without removing the maxlength attribute?

like image 633
sapataso Avatar asked Apr 25 '13 20:04

sapataso


1 Answers

You can use the novalidate and formnovalidate attributes. See this link for more information.

Internet Explorer 10 and Windows Store apps using JavaScript add new support for HTML5 Forms, including new states of the type attribute (on the input element), new attributes for the input element, and the progress element. This support enables developers to quickly and easily provide user prompting, input validation, and feedback with a minimal amount of script.

Source: http://msdn.microsoft.com/en-us/library/ie/hh673544(v=vs.85).aspx

like image 174
Peter Avatar answered Sep 28 '22 07:09

Peter