#16512 closed defect (fixed)
dijit.form.CheckBox HTTP POST broken in IE 7, 8
Reported by: | getittogether | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | undecided | Milestone: | 1.8.4 |
Component: | Dijit - Form | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The dijit CheckBox? widget does not pass POST data in IE 7-9
The following snippet works as expected in:
- Dojo 1.8.1
- Dojo 1.8.3 + Firefox
It does not work in:
- Dojo 1.8.3 + IE 7-9
Send a HTTP POST request with a dijit checkbox. This problem can also be reproduced when using dojo.xhrPost with the 'form' attribute filled.
File: index_dijit.php
<form id="myForm" dojoType="dijit.form.Form" method="post" action="index_dijit.php"> <input name="test" id="test" dojoType="dijit.form.CheckBox" /> Test <input type="submit" value="Submit" /> </form> <?php print_r($_POST); ?>
Attachments (1)
Change History (18)
comment:1 Changed 8 years ago by
comment:2 follow-up: 3 Changed 8 years ago by
Owner: | changed from Douglas Hays to getittogether |
---|---|
Status: | new → pending |
Sounds like a difference in behavior of how IE and other browsers handle native unchecked checkboxes when submitting forms, rather than an issue with dijit?
comment:3 Changed 8 years ago by
Status: | pending → new |
---|
Replying to bill:
Sounds like a difference in behavior of how IE and other browsers handle native unchecked checkboxes when submitting forms, rather than an issue with dijit?
I'm sorry, I meant to add that it does not submit the "on" data even when the dijit checkbox is checked.
comment:4 Changed 8 years ago by
Owner: | changed from getittogether to Douglas Hays |
---|---|
Status: | new → assigned |
That's very strange, because it's using a native checkbox underneath the pretty one.
comment:5 follow-ups: 6 7 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
This is working for me. Of course your snip-it doesn't load Dojo so it can't work standalone nor does it set type=checkbox. Here's my working standalone example:
http://doughays.dojotoolkit.org/work/index_dijit.php
comment:6 Changed 8 years ago by
Replying to doughays:
This is working for me. Of course your snip-it doesn't load Dojo so it can't work standalone nor does it set type=checkbox. Here's my working standalone example:
http://doughays.dojotoolkit.org/work/index_dijit.php
Thanks for setting up the example, but I'm seeing the same erroneous behavior when visiting your test site: The array is empty after ticking the checkbox and clicking Submit (IE7, which is unfortunately what most of our users have installed).
There may be something in my company's environment that causes IE7 + Dojo 1.8.3 to handle checkboxes differently, however the problem isn't present in Dojo 1.8.1, which leads me to believe something changed between Dojo 1.8.1 and 1.8.3.
comment:7 Changed 8 years ago by
Replying to doughays:
This is working for me. Of course your snip-it doesn't load Dojo so it can't work standalone nor does it set type=checkbox. Here's my working standalone example:
http://doughays.dojotoolkit.org/work/index_dijit.php
I think I've found a potential fix for the issue I'm seeing. I've narrowed the problem down to a commit to Dojo 1.8.2: r29816.
Specifically, in: http://bugs.dojotoolkit.org/changeset/29816/dojo/dijit/trunk/form/_ToggleButtonMixin.js
On line 36,
node.setAttribute("checked", "");
might need to be:
node.setAttribute("checked", !!value);
When this change is made, IE7 passes the checked state correctly.
comment:8 follow-up: 9 Changed 8 years ago by
Did you mistype your suggestion? Looks like [29816] changed it from node.setAttribute("checked", "") to node.setAttribute("checked", !!value), and that's when the problem on IE7 started for you. The latter looks suspicious to me since it's setting an attribute to a non-string value.
comment:9 Changed 8 years ago by
Replying to bill:
Did you mistype your suggestion? Looks like [29816] changed it from node.setAttribute("checked", "") to node.setAttribute("checked", !!value), and that's when the problem on IE7 started for you. The latter looks suspicious to me since it's setting an attribute to a non-string value.
No, my suggestion is to replace the blank string with !!value. r29816 seemed to delete the attribute on the node, which possibly caused the IE7 problem.
Instead of setting the attribute to "!!value", I think a non-empty string might work too; I was just following the pattern on line 34.
comment:10 Changed 8 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
I see.
Doug, in any case, this reproduces for me, when loading http://doughays.dojotoolkit.org/work/index_dijit.php on IE7 and then clicking the checkbox and pressing submit, it displays an empty result rather than listing the checkbox as checked.
comment:11 Changed 8 years ago by
Milestone: | tbd → 1.8.4 |
---|
comment:12 Changed 8 years ago by
Summary: | dijit.form.CheckBox HTTP POST broken in IE 7, 8, 9 → dijit.form.CheckBox HTTP POST broken in IE 7, 8 |
---|
comment:16 Changed 8 years ago by
Replying to doughays:
In [30469]:
Will this fix the same behavior found within radio buttons? I recently rolled back an upgrade to 1.8.3 due to issues with radio button checked behavior and IE 7 not realizing that the buttons had been selected and always returning false even if the attribute was set with checked="". The fix suggested above seems to have fixed this issue for me, but you seemed to conclude that this fix could not be made to the location specified without breaking the tab behavior.
comment:17 Changed 8 years ago by
Radiobutton inherits from CheckBox? so these issues should be fixed there as well.
I'm not sure I understand the problem. In the provided example, the CheckBox is not checked and so it should not submit test=on with the POST data. What are you expecting to be submitted?