Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

input type="number" is valid when a non numeric value is entered in IE 11 #7070

Closed
brik opened this issue Apr 10, 2014 · 8 comments
Closed

Comments

@brik
Copy link

brik commented Apr 10, 2014

When entering text or a combination of text and numbers, form.number.$valid" does not always validate to false.

Examples:
"ddd" validates to true (not OK)
"ddd3" validates to true (not OK)
"3ddd" validates to false
"33" validates to true

When using the required attribute, it works as expected.

Tested OK in Chrome and Firefox 28.0

Plnkr: http://plnkr.co/edit/uqOkCPxNYQWg8xog1IKi?p=preview

Looks like it is a similar issue to #2144

@caitp
Copy link
Contributor

caitp commented Apr 10, 2014

I can look into this later today (but if you can debug this, I would suggest looking at this glob of text, this is probably where the problem is)

@brik
Copy link
Author

brik commented Apr 10, 2014

It seems to enter the if statement from the glob in both Chrome and IE, but the ValidityState object is different in IE. I don't know if this helps at all...

Chrome ValidityState
badInput: true
valid: false

IE 11 ValidityState
badInput: false
valid: true

@caitp
Copy link
Contributor

caitp commented Apr 10, 2014

If you're entering letters in a number input, and IE is not setting badInput to true, then they're not behaving consistently with the spec (for better or worse, some of the things in that spec are kind of nonsense). But even so, the regexp should be invalidating it.

@brik
Copy link
Author

brik commented Apr 10, 2014

My bad @ badInput, I was testing this inside an ng-grid and got slightly different results there, outside the grid badInput is undefined. Same behavior still though.

@caitp
Copy link
Contributor

caitp commented Apr 10, 2014

I can confirm that this is happening.

Unfortunate as it is, I don't think there's much we can really do about it.
IE is not doing the right thing here. All we see is the empty string, and
we get no way to know that the string is empty due to an error. That's too
bad.

On Thu, Apr 10, 2014 at 9:17 AM, brik [email protected] wrote:

My bad @ badInput, I was testing this inside an ng-grid and got slightly
different results there, outside the grid badInput is undefined. Same
behavior still though.

Reply to this email directly or view it on GitHubhttps://github.com//issues/7070#issuecomment-40078139
.

@brik
Copy link
Author

brik commented Apr 14, 2014

Ok, that's a shame. Thanks for looking into it anyway.

@caitp caitp added this to the Backlog milestone May 22, 2014
@caitp
Copy link
Contributor

caitp commented May 22, 2014

I don't think this is really fixable on Angular's side, but I have raised an issue about this with MS at https://connect.microsoft.com/IE/feedback/details/850187/html5-constraint-validation-is-broken-in-ie11-for-input-type-number --- If people +1 it, maybe that could be fixed for the next iteration. I don't know.

I will leave this issue open and possibly revisit it later

@Narretz
Copy link
Contributor

Narretz commented Jun 6, 2015

Tracked in #10981 with more info

@Narretz Narretz closed this as completed Jun 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants