Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#10733 closed defect (fixed)

RadioButton cannot take attribute label

Reported by: David Moore Owned by: bill
Priority: high Milestone: 1.5
Component: Dijit - Form Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

I am trying to put a dijit.form.RadioButton? into a dojox.layout.TableContainer?, all created programmatically. To get a field displaying, I need to set the "label" attribute on the RadioButton?. An error is thrown on that. After tracing down, this is because setting label on RadioButton? sets the innerHTML of the containerNode, and containerNode is null. I created the RadioButton? with the following code:

var required = dijit.byId(cell.name+"_required");
if (!required)
{
    required = new dijit.form.RadioButton({id: cell.name+"_required",
            name: "required",
            "label": "Required"
    });
}

Change History (4)

comment:1 Changed 9 years ago by David Moore

I worked around the issue with the following code (clearly showing that the issue is the containerNode):

var required = dijit.byId(cell.name+"_required");
if (!required)
{
    // TODO: This is a workaround for a dojo bug - a programmatically created RadioButton has no containerNode
    reqnode = dojo.create("div", {"id": cell.name+"_required", "style": "display: none"}, basic_options.domNode);
    required = new dijit.form.RadioButton({id: cell.name+"_required",
            name: "required"
    }, cell.name+"_required");
    required.containerNode = reqnode;
    required.startup();
    required.attr('label','Required');
}

comment:2 Changed 9 years ago by bill

Milestone: tbd1.5
Owner: set to bill
Status: newassigned

You could also just use "title" rather than "label" for the RadioButton attribute.

But I'll checkin a fix.

comment:3 Changed 9 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [21351]) Don't fail if app specifies a label for a dijit.form.CheckBox. Although label doesn't mean anything to CheckBox itself, it's referenced by dojox.layout.TableContainer (with a dijit.form.CheckBox child).

Also removing label from dijit.form.Button.attributeMap, since Button has a _setLabelAttr() method.

Fixes #10733 !strict.

comment:4 Changed 8 years ago by bill

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