Hello.

We have a form with around 20 checkbox, and we want people select only 5 of them.

We have try Exact number of selections required and also one mix of maximum (5) and minimum (5) elements in the form.

But the validation tell us: "Please, select 5 options in the element.

Our group of checkbox are into en fieldset.

Thanks

Oskar

Comments

svendecabooter’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

Can you elaborate a bit more on your setup?
Are you using Webform 2 or 3? Are you using the latest version of the webform module within that branch?

I have tried to recreate this issue by creating a new webform with a fieldset. Within the fieldset I added a 'select' component with about 20 elements. The component was set to "Multiple" to have checkboxes. I added the "Exact number of selections required" validation rule, with a value of 5.
Several tests confirmed that this is working as advertised.

Could you give more information on what you tried?

crosendahl’s picture

Status: Postponed (maintainer needs more info) » Active

I am having this problem, too. I am using Webform 6.x-2.9, Webform Validation 6.x-1.3. I need to have a long list with a maximum number of selections.

As an easy test I set up a simple form with one 'select' component. I entered three options and checked 'Multiple' in the component. Under Form Validation I made a rule called 'max 2', selected my component, set the Maximum number of selections to 2, and added the rule.

When viewing the webform, I get the same notice regardless of selecting 1, 2, or 3 items: "Please select maximum 2 options for Nominees'.

This is also the case for exact or minimum.

tanjerine’s picture

This is happening on my setup too. I am using Webform 6.x-1.3 with webform 6.x-2.10. I have a selection with 6 items, and i need the user to pick 3 out of the 6. No matter how many I pick, it keeps telling me that I have to select a maximum of 3.

svendecabooter’s picture

Status: Active » Needs review

This problem has been introduced when attempting to fix #833500: Doesn't work for fields inside a fieldset.
Could you test the latest files from CVS HEAD and check if this fixes the problem?

svendecabooter’s picture

Status: Needs review » Postponed

--- please ignore, replied to wrong issue ---

svendecabooter’s picture

Status: Postponed » Needs review
svendecabooter’s picture

Status: Needs review » Postponed (maintainer needs more info)

Are people experiencing this problem perhaps using a 0 as one of the keys in the options?
There is a problem in Webform 2 when you use 0 as an option key, because it doesn't get registered as a valid selection.

If not using a 0 keyed option, I cannot reproduce this problem with Webform 2.9 and Webform Validation 1.3, or don't use 0 as key.
Easiest would be to upgrade to the Webform 3.x branch, as I'm not sure i'll be able to find a decent solution for the problem, and the 2.x branch is being phased out anyway...

liam morland’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Presuming fixed. If this is still a problem, please re-open and provide details.