#16208 closed defect (worksforme)
dijit.form.TextBox.get('value') returns (almost) null with IE8
Reported by: | Alexander Kläser | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.8.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
We observed a strange behaviour with TextBoxes? in Dojo 1.8.1. With IE8 (Windows XP), an emtpy TextBox? would return null as value. Well, not really null, as (value === "") is true and (value === null) is false, its type is string, however dojo.toJson() would render it as "null".
Example: http://jsfiddle.net/rVmbK/8/ -> remove the text in the textbox and press Tab.
As workaround, we use:
if (value === "") { value = ""; }
Although this workaround seems to be meaningless, it helps. The same problem would not occur with Dojo 1.6.
Attachments (3)
Change History (20)
Changed 10 years ago by
comment:1 Changed 10 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Using your example on my IE8 install, toJson returns "" and everything looks correct.
Changed 10 years ago by
Attachment: | screenshot-ie8-null-bug.png added |
---|
Screenshot that shows that the bug can be reproduced
comment:2 Changed 10 years ago by
Thanks for your answer.
That is strange. We were 2 people that could reproduce the bug independently with the jsfiddle sample (see screenshot). I'm using Windows XP Professional Version 2002 Service Pack 3 here. Do you have any idea from where the difference may come? Both browser seem to be exactly the same version. I tried to change security settings, but that would not change the result. As said, the bug would occur only with Dojo 1.8.
comment:3 Changed 10 years ago by
We also observed the problem on another system running Windows Vista with IE8. IMHO is WORKSFORME not appropriate.
Changed 10 years ago by
Attachment: | worksForBill.gif added |
---|
it correctly gives "" for me from the JSFiddle site
comment:4 Changed 10 years ago by
Perhaps some kind of non-standard compatibility mode/document mode/quirks mode via the debugger? Just throwing out ideas.
comment:5 Changed 10 years ago by
I found the following related posts that could shed some more light on the problem:
- http://blogs.msdn.com/b/jscript/archive/2009/06/23/serializing-the-value-of-empty-dom-elements-using-native-json-in-ie8.aspx
- http://community.xajaxproject.org/topic/9002/empty-input-fields-in-ie8-send-as-null/
- http://code.google.com/p/jquery-json/issues/detail?id=44
- http://yuilibrary.com/projects/yui3/ticket/2528369
It seems to be a bug with the native JSON conversion method in IE8.
comment:6 follow-up: 7 Changed 10 years ago by
Interesting. So, this works correctly on my IE8:
>> JSON.stringify(document.createElement("input").value) """"
I guess it returns "null" on yours?
comment:7 Changed 10 years ago by
Replying to bill:
[...] I guess it returns "null" on yours?
Yes, my IE8 outputs "null" with this piece of code. But this cannot be a Browser issue as our browser versions do match exactly (as far as I could see). Maybe its only a bug with service pack 3? Do you have service pack 3 or 2?
comment:9 Changed 10 years ago by
There seems to be an update that addresses problems in the native JSON implementation: http://support.microsoft.com/kb/976662
Looking on my Windows system, I found the following versions of jscript.dll:
- C:\WINDOWS\system32 → version 5.8.6001.18702
- C:\WINDOWS\ServicePackFiles?\i386 → version 5.7.0.16599
Maybe my IE8 is using the older version of the two libs?
comment:10 Changed 10 years ago by
Hmm, interesting. It sure looks like that update is the difference between our systems.
It seems like IE would be using the jscript.dll in C:\WINDOWS\system32. And my version of C:\WINDOWS\system32\jscript.dll is 5.8.6001.23141... a little bit newer than yours.
comment:12 Changed 10 years ago by
Looks like you have the following Update installed: http://support.microsoft.com/kb/2510531
comment:14 Changed 10 years ago by
Probably because I'm using a bit older virtual machine image that I have not updated.
comment:15 Changed 10 years ago by
OK, meaning that Windows Update automatic updates are not turned on? I don't think that's something that we want to support.
comment:17 Changed 9 years ago by
This blog http://blogs.msdn.com/b/jscript/archive/2009/06/23/serializing-the-value-of-empty-dom-elements-using-native-json-in-ie8.aspx details the issue and gives a solution.
screenshot showing it working