locked
input pattern="^[0-9]*$" broken in IE11

    Question

  • Setting the pattern of a numeric input field to "^[0-9]*$" still allows inputs of "343ddd" and "23332,232"

    Also, the validation is not performed when the field is not only marked as "required". Are those bugs or do I miss something from the Standard`?

    Wednesday, July 2, 2014 8:00 PM

Answers

  • Prashant, that is not an option. I want the softkeyboard to show the number pad when the input is focused.

    I think the pattern matching in IE11 is heavily broken:

    ^[0-9]{1,3}[.]?[0-9]{1,3}[.]?[0-9]{1,3}?$

    does also not work at all in an input field.

    edit: forget that. IE11 is just following the standard which does not allow pattern to be set on number fields for reasons beyond me.
    Thursday, July 3, 2014 11:12 PM

All replies

  • Hi Phil,

    Why don't you use the type=text and give it a pattern? The below code appears to work just fine - accept only numbers:

        <form>
            <input title="Use Numbers only" type="text" pattern="^[0-9]*$">
            <button type="submit">Submit</button>
        </form>


    Windows Store Developer Solutions, follow us on Twitter: @WSDevSol|| Want more solutions? See our blog

    • Proposed as answer by pkursawe Thursday, July 3, 2014 11:14 PM
    Thursday, July 3, 2014 12:40 AM
    Moderator
  • Prashant, that is not an option. I want the softkeyboard to show the number pad when the input is focused.

    I think the pattern matching in IE11 is heavily broken:

    ^[0-9]{1,3}[.]?[0-9]{1,3}[.]?[0-9]{1,3}?$

    does also not work at all in an input field.

    edit: forget that. IE11 is just following the standard which does not allow pattern to be set on number fields for reasons beyond me.
    Thursday, July 3, 2014 11:12 PM