Opened 9 years ago

Last modified 23 months ago

#10819 assigned enhancement

[patch][cla][needs update to AMD] add function to return selected value in a checkbox/radio

Reported by: Jean-Rubin Leonard Owned by: bill
Priority: high Milestone: 1.14
Component: Dijit - Form Version: 1.4.0
Keywords: radio button checkbox value selected group Cc:
Blocked By: Blocking:

Description

Currently there is no API method that allows to return the selected value of a radio button or of a checkbox easily. One must use dojo.query/filter/map. While it seems I was able to obtain one recipe to obtain the said information or another, a built in method that allowed to do that would be very convenient and more straight forward to use to the average user. I believe Karl Tiedt/tk/Tekky has a patch handy that would allow to return the selected value in a radio/checkbox. JR

Attachments (1)

checkboxgroupvalue.patch (1.2 KB) - added by Karl Tiedt 9 years ago.
attr('groupvalue') patch

Download all attachments as: .zip

Change History (18)

comment:1 Changed 9 years ago by bill

Alternately I've often thought a container widget (a fieldset, see #10171) to hold a bunch of radio buttons or checkboxes, plus labels (with the same name) would be good. Then you could call attr("value") on it etc... like a Select or MultiSelect widget but with the checkbox / radio button UI.

Last edited 7 years ago by bill (previous) (diff)

Changed 9 years ago by Karl Tiedt

Attachment: checkboxgroupvalue.patch added

attr('groupvalue') patch

comment:2 Changed 9 years ago by Karl Tiedt

There is the patch that simpli mentioned :) it is basically just a modified version of the setValueAttr query used by RadioButton?

comment:3 Changed 9 years ago by bill

Milestone: tbd1.6

OK, thanks!

comment:4 Changed 9 years ago by Jean-Rubin Leonard

Hello, the code I believe has not been added to the nightlies. Is there anything in particular that needs to be done for be to be committed?

Thanks for letting me know, JR

comment:5 Changed 9 years ago by Karl Tiedt

thumbs up from BDFL I believe i all thats needed. Or counter suggestion for better name or implementation if thats being questioned

comment:6 Changed 9 years ago by bill

Milestone: 1.61.7

comment:7 Changed 8 years ago by bill

Milestone: 1.71.8

running out of time for 1.7

comment:8 Changed 8 years ago by bill

Component: DijitDijit - Form
Owner: set to Douglas Hays

comment:9 Changed 7 years ago by Douglas Hays

Milestone: 1.8tbd

So Form is a widget container that returns group values as an array
form.get('value')[id]

comment:10 Changed 6 years ago by bill

So Form is a widget container that returns group values as an array form.get('value')[id]

That's true, and incidentally the code in dijit/Form to handle checkboxes is similar to the patch in this ticket.

I was just thinking of a lighter-weight widget that could optionally sit inside of a dijit/form/Form, but I guess dijit/form/Form is sufficient.

http://download.dojotoolkit.org/release-1.9.0/dojo-release-1.9.0/dojox/form/tests/test_CheckedMultiSelect.html is also another approach.

So anyway, I don't care one way or another. The patch in this ticket is fine with me, or you could just close the ticket as wontfix.

comment:11 Changed 6 years ago by Douglas Hays

Owner: Douglas Hays deleted
Status: newassigned

comment:12 Changed 6 years ago by Douglas Hays

Status: assignedopen

comment:13 Changed 4 years ago by dylan

Milestone: tbd1.11
Owner: set to bill
Status: openassigned
Summary: add function to return selected value in a checkbox/radio[patch][cla][needs update to AMD] add function to return selected value in a checkbox/radio

There's a fairly simple patch for this that we probably should have landed 6 years ago. It needs a small update to make it compliant with modern best practices, but we should land this if possible.

comment:14 Changed 4 years ago by bill

If someone wants to submit a PR with an automated test, that would be great. Since it's a public API it shouldn't have an underscore in the name.

comment:15 Changed 4 years ago by dylan

Milestone: 1.111.12

Ok, after massive triage, ended up with about 80 tickets for 1.11 and 400 or so for 1.12. That's a bit unrealistic, so first I changed all 1.12 to 1.13 (with the plan to move some forward to the new 1.12. Now, I'm moving some of the 1.11 tickets that are less likely to get done this month without help to 1.11. Feel free to help out in January if you want to see this ticket land in 1.11.

comment:16 Changed 3 years ago by dylan

Milestone: 1.121.13

Ticket planning... move current 1.12 tickets out to 1.13 that likely won't get fixed in 1.12.

comment:17 Changed 23 months ago by dylan

Milestone: 1.131.14
Note: See TracTickets for help on using tickets.