Skip to content
This repository

Checkbox list with same name do not allow multiple selection #1851

Closed
SJai opened this Issue · 4 comments

5 participants

SJai Kin Blas Todd Parker BrandnameBob Anne-Gaelle Colom
SJai
SJai commented

The checkboxradio plugin treats a check box list with same value for the name attribute for the check boxes as radio buttons. Hence the plugin allows to select only one item whereas the expected behavior is to select multiple items. When the checkbox list is rendered as native controls they behave as expected.

To allow multiple selection, as a workaround we have to provide unique names for each checkbox. This adds a extra amount of work at the server side to gather all the selected checkboxes values. If they are posted with same names, we can use the name to get a comma separated list of selected checkboxes values.

Please work on this.

BrandnameBob

I am also experiencing this issue, the problem seems to lie in _getInputSet() within the mobile.checkboxradio widget.

Adding the following as the first line seems to fix it:
``` if(this.inputtype == "checkbox")
return this.element;

Tobias Bosch tbosch referenced this issue from a commit in tbosch/jquery-mobile
unit tests for #1851 added. ec06fc1
Timmy Willison timmywil referenced this issue from a commit
unit tests for #1851 added. cee9150
Anne-Gaelle Colom
Collaborator

I have created a jsfiddle where I have two sets of checkboxes (one 'normal' and one in a control group): http://jsfiddle.net/agcolom/Au9zy/8/

All checkboxes in the 1st set have the same name. All checkboxes in the 2nd set have the same name (but a different name than the checkboxes in the 1st set). In both sets, I can select none, one or many checkboxes.

So unless I misunderstood what the issue was, it looks fixed :-)
@SJai Did I understand your issue correctly?

Thanks,

Anne

Anne-Gaelle Colom
Collaborator

@toddparker I cannot reproduce and had no reply in a month. I suppose we can close.

Todd Parker

Closing as fixed but we can reopen if someone chimes in with details.

Todd Parker toddparker closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.