Opened 9 years ago

Closed 4 years ago

#11611 closed enhancement (patchwelcome)

Checkbox: ability to specify label field when creating programatically

Reported by: scheid Owned by:
Priority: high Milestone: 1.13
Component: Dijit - Form Version: 1.5
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

It would facilitate creating checkboxes if I could optionally specify a label field for a checkbox exactly like I do when I create a dijit.form.Button.

so, instead of having to do this:

chk = dojo.create("input", {id:"cbox", type:"checkbox"}, container);
lbl = dojo.create("label", {innerHTML:"Check me", "for":"cbox"}, container);
new dijit.form.CheckBox({}, chk);

I could just do this:

chk = dojo.create("input", {id:"cbox", type:"checkbox"}, container);
new dijit.form.CheckBox({label:"Check Me"}, chk);

The <label> dom element would be created automatically when instantiated.

Change History (10)

comment:1 Changed 9 years ago by bill

Component: GeneralDijit
Description: modified (diff)
Milestone: tbd1.7
Owner: anonymous deleted
Summary: ability to specify label field for dijit.form.CheckBox when creating programaticallyCheckbox: ability to specify label field when creating programatically

Yes, this is a common request, I guess mainly coming from swing developers. destroy() would need to remove the label too. And need to decide whether "label" is rich text or plain text.

comment:2 Changed 9 years ago by cjolif

This is not just from Swing developpers. Most UI toolkits I know of (Silverlight, Flex, and yes Swing) do have a label on Checkbox. Actually even in Dojo, Checkbox inherits (like in that other toolkits) from ToggleButton?. Just that inheritance scheme shows that label is highly expected...

comment:3 Changed 9 years ago by bill

Milestone: 1.71.8

running out of time for 1.7

comment:4 Changed 9 years ago by bill

Component: DijitDijit - Form
Owner: set to Douglas Hays

comment:5 Changed 8 years ago by bill

Blocking: 12905 added

comment:6 Changed 8 years ago by Douglas Hays

Milestone: 1.8tbd

The label in ToggleButton? is different than the LABEL tag - probably just poorly named. Patches are welcome. The generated LABEL element would need to be text-direction aware.

comment:7 Changed 7 years ago by bill

See also #16017 for BIDI issues.

comment:8 Changed 6 years ago by Douglas Hays

Owner: Douglas Hays deleted
Status: newassigned

comment:9 Changed 6 years ago by Douglas Hays

Status: assignedopen

comment:10 Changed 4 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: openclosed

Given that no one has shown interest in creating a patch in the past 5+ years, I'm closing this as patchwelcome.

Note: See TracTickets for help on using tickets.