Opened 11 years ago

Closed 11 years ago

Last modified 9 years ago

#7493 closed defect (invalid)

dojo.query doesn't retrieve result for RadioButtons

Reported by: nunomartinsinet Owned by:
Priority: high Milestone: 1.2
Component: Dijit - Form Version: 1.1.1
Keywords: dojo.query, radio, buttons, forEach Cc:
Blocked By: Blocking:

Description (last modified by bill)

Using the dojo version 1.1.1 (latest revision from repository in tags) in FF3 with Ubuntu I tried the following code in a form with some input texts and radio buttons:

dojo.query('[widgetId]').forEach(
                            function(w) {
                                var widget=w.id;
                                if(dijit.byId(widget)) {
                                    dijit.byId(widget).destroy();
                                }
                            });

Everything go fine for the input texts, but it retrieves me the following error because of the radio buttons:

"Error: Tried to register widget with id==XXX but that id is already registered"

I fixed the problem with the following change in my code:

dojo.query('div[widgetId],input.dijitCheckBoxInput').forEach(
                            function(w) {
                                var widget=w.id;
                                if(dijit.byId(widget)) {
                                    dijit.byId(widget).destroy();
                                }
                            });

Thanks and keep up the good work,

You can contact me by email: nunomartinsinet@…

Change History (2)

comment:1 Changed 11 years ago by bill

Description: modified (diff)
Resolution: invalid
Status: newclosed

Looks like dojo.query() is working correctly to me.

There's no reason to assume that the top node of a widget (this.domNode) has an id attribute. It's often true, but certainly not guaranteed.

You should call dijit.byNode() on each node returned from dojo.query()

comment:2 Changed 9 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.