Evidence Item #12826 in the case of Microsoft VS Web Developers
JavascriptI feel like a misguided Kanye West proclaiming "Bill Gates doesn't care about web people!", but seriously... What is it? Why is it so hard to just follow the same standard that other browsers don't seem to have such a hard time with?
After my 3rd Internet Explorer specific problem in about 24 hours, I had to share this one since it is very easy to demonstrate, and I am sure that someone will bang their head on it in the future. I have come to the conclusion that without some hack workaround of setting temp javascript variables, it is not possible to scrub the value of a form field with an onKeyUp event, and then take action on that scrubbed value at onChange.
Here is a simple example:
The idea behind that code is that with each keystroke, we are going to pull out invalid characters from the field. Then on our update, we are going to do something with that value. Presumably, that would be something more helpful than an alert, such as in my case where I wanted to do an Ajax update to a session scoped bean that was child of a user facade, but you get the idea. This works in Firefox and Opera without a hitch. IE6? nope. IE7? nope...
I wondered if it might have been simply a problem with the way that I was modifying the string and then returning it. So I tried just returning the original string like this:
Nope... still the same.
So what the hell is going on here? At this point I had a suspicion that it had to do with the fact that we are resetting the value of the field before the onChange, which I confirmed with this:
So there it is... Apparently, Microsoft does not think that you ought to be able to alter a field's data with onKeyUp, and then do something onChange. For what it is worth I found that this exact same behavior happens with TMT_Validator when using field filtering. I used to feel that this was an issue with TMT itself, but obviously it is IE itself.
So... a big thanks to IE Team for once again killing part of my day.






Loading....