#4952 closed defect (duplicate)
IE 7,IE 6 problem with dijit.form.CheckBox
Reported by: | guest | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Dijit - Form | Version: | 1.0 |
Keywords: | IE7, checkbox | Cc: | |
Blocked By: | Blocking: |
Description
I came across an odd problem as I was testing a bit of code against IE (this works fine in Firefox and other browsers). Per old fashioned HTML/DOM, if the checkboxes all share the same name, the checkbox values get shoved into an array in the DOM, which can be accessed via document.formName.checkboxName. You can then loop through the checkboxes with simple for loop using document.formName.checkboxName.length. In Firefox, the function 'testCheckBoxes()' runs fine...but in IE it fails and throws an error somehwere in dojo.js. IF however, I remove the dojoType="dijit.form.CheckBox?" from each of the input tags and run 'testCheckBoxes()' in IE (which means that they're just regular HTML checkboxes then), everything works fine.
I have found this problem in the .9 codebase, a nightly build from last week, and the 10/30/07 nightly build.
<CODE> <!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN"
<html> <head>
<title>checkbox test</title> <script type="text/javascript" src="assets/js/dojo10/dojo/dojo.js" djConfig="isDebug: false, parseOnLoad: true,usePlainJson:true" ></script> <script type="text/javascript">
dojo.require("dijit.form.CheckBox?"); dojo.require("dijit.form.Form"); dojo.require("dojo.parser"); scan page for widgets and instantiate them
function testCheckBoxes()
{ alert("test"); for (i=0;i<document.myForm.brands.length;i++)
{ alert(document.myForm.brands[i].checked); }
}
</script> <style type="text/css">
@import "assets/js/dojo10/dojo/resources/dojo.css"; @import "assets/js/dojo10/dijit/themes/tundra/tundra.css";
</style>
</head> <body class='tundra'>
<table cellpadding='0' cellspacing='0' border='0' class='tundra'>
<tr>
<td><form name="myForm">
<table cellspacing='0' cellpadding='0' border='0'>
<tr>
<td><input checked="checked" type="checkbox" name="brands" dojoType="dijit.form.CheckBox?" value="W"> </td> <td> </td> <td><input checked="checked" type="checkbox" name="brands" dojoType="dijit.form.CheckBox?" value="N"> </td> <td> </td> <td><input checked="checked" type="checkbox" name="brands" dojoType="dijit.form.CheckBox?" value="P"> </td> <td> </td> <td><input checked="checked" type="checkbox" name="brands" dojoType="dijit.form.CheckBox?" value="C"> </td> <td> </td> <td><input checked="checked" type="checkbox" name="brands" dojoType="dijit.form.CheckBox?" value="V"> </td> <td width='10'><a href="javascript:testCheckBoxes()">link</a></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body> </html> </CODE>
Change History (2)
comment:1 Changed 13 years ago by
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
This looks like a dup of #4753 (or rather, it's another manifestation of the same bug). I'm going to close this. Try against the latest code to make sure the problem is fixed.