Steps to reproduce

1. Install Webform 4.19 (careful!!! - this one has a known security issue, so do not do this on a production site)
2. Create a new webform.
3. Add a new component of type "Select options", called "Was this page useful?", and set it to required.
4. As options for the element created in step 3, add 1|Yes and 2|No, and save.
5. Create another component of type "Select options", called "Why yes?", and set it to be both multiple and required.
6. As options for the element created in step 5, add easy|Was easy, makes_sense|Makes sense, and other|Other, and save.
7. Create yet another component of type "Select options", called "Why no?", and also set it to both multiple and required.
8. As options for the element created in step 7, add because|Because, confusing|Was confusing, and dont_wanna_say|Don't want to say, and save.
9. Add the following conditionals:

9.1. if Was this page useful? | is empty | or
if Was this page useful? | is | No
then Why yes? | isn't | shown
then Why yes? | isn't | required

9.2 if Was this page useful? | is empty | or
if Was this page useful? | is | Yes
then Why no? | isn't | shown
then Why no? | isn't | required

10. Test the webform:
10.1. Select either "Yes", or "No"
10.2. Try submitting the form without selecting any of the options for "Why yes/no" -> validation error shown (as expected), in the form of a drupal_set_message error
10.3. Select only one of the options in the checkboxes that are shown
10.4. Submit the form -> form is submitted w/o any errors (as expected)

11. Update the Webform module to version 4.20 (no database updates required).

12. Test the form again:
10.1. Select either "Yes", or "No"
10.2. Try submitting the form -> validation error shown (as expected), notice that the error is now shown as a popup
10.3. Select only one of the options in the checkboxes that are shown
10.4. Submit the form -> form is not submitted (regression) -> another popup validation error is shown, saying that the next option in the checkboxes is required.
10.5. Keep repeating steps 10.3 and 10.4, selecting the next checkbox and trying to submit the form -> the form is only submitted when all checkboxes have been selected

Original report

Hi,
I have a webform with a multiple choice select field. The field is marked as required.

When I try to complete the form and check one of the options, I get an error message which says that the last check box is required. When I try to validate the form by checking the last check box, i get an error message that says the second last check box is required, and so on... till all check boxes are checked.

It's like the webform module treats the check boxes as separate fields.

I had also the "Webform validation" module installed, but even when I deactivate the module, I got the same problem.

Comments

manicato’s picture

... this happens even if I uncheck the "required" option!

quicksketch’s picture

Hm, this sounds quite unusual. Do you have the Select or Other module installed on your site? Or is there anything special about your checkboxes?

manicato’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
Assigned: Unassigned » manicato
Status: Active » Closed (works as designed)

I'm sorry. I choose the wrong Drupal Version it's 6.x-3.x-dev.

It found the problem.

In fact, there was a module which causes this error: Client Side Validation module
It's not essential, so I removed it.

klonos’s picture

Title: Check box validation does not work » Checkboxes that are set to both multiple + required keep requiring the next checkbox to be ticked, until all of them are checked
Version: 6.x-3.x-dev » 7.x-4.x-dev
Component: User interface » Code
Assigned: manicato » Unassigned
Priority: Major » Normal
Issue summary: View changes
Status: Closed (works as designed) » Active

I am seeing this on a site that does not have the Client Side Validation module.

I will need some time to test this in a vanilla installation, and on a webform with just enough fields to reproduce the problem. I'll report back soon.

klonos’s picture

Issue summary: View changes
klonos’s picture

I have updated the issue summary. ...this seems to have regressed from 4.19 to 4.20, with the introduction of the popup validation errors.

klonos’s picture

Issue summary: View changes
liam morland’s picture

Please use git bisect to determine which commit caused this problem.

klonos’s picture

Sure thing @liam-morland. Here it is:

61ec37f8fd2d06bc1d5c2b2094559357fce8004b is the first bad commit
commit 61ec37f8fd2d06bc1d5c2b2094559357fce8004b
Author: sammuell <sammuell@1831274.no-reply.drupal.org>
Date:   Thu Jun 27 16:10:51 2019 -0400

    Issue #3032336 by sammuell: Allow conditionals to remove @required from single checkbox

 js/webform.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

...so it seems to have been introduced with #3032336: Conditional required does not work for single checkbox

liam morland’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.