-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validation of a checkbox group. #40
Comments
Possible duplicate? #17 Let me know if its not and I'll reopen. |
Bonjour, |
Apologies, but I'm not 100% sure I understand the desired behavior. Can you clarify? |
I have a group of 12 checkboxes with the same attributename="Cours[]". But we can not find this operation with the latest version 1.4.2 Is it possible to find this operation with the version 1.4.2? |
This is exactly the issue i'm having using 1.4.3. Checkboxes that are part of the same checkbox group (i.e. they have the same value in the name attribute) are validated separately and not as a whole in this version of Bouncer. Desired behaviour is that checkboxes with the same name attribute are treated as a group. This means that if a single checkbox is ticked within this group it will be valid as the requirement is met. |
Digging into this a little bit more, that's not consistent with how browsers treat checkboxes natively or what the expectation for checkboxes are. A more robust form validator might better fit your needs around this. |
Just for future reference, for anyone struggling with this, you can make Bouncer work to validate a group of checkboxes where at least one must be checked: The downside is you cannot use the @cferdinandi I'd definitely welcome if you think this could be done more simply :) |
That said, the above starts outputting multiple error messages if you assign values to the checkboxes... which seems odd: https://codepen.io/iamkeir/pen/wVmKyV?editors=1010 Possible bug? Related to #17? |
Ref: #47 |
I agree. A checkbox group with the same name attribute should be validated as a whole. |
In case anyone runs across this, here's one way to validate a set of checkboxes: |
Bonjour,
I would like to validate a checkbox group with the latest version of bouncer.js 1.4.3 as the following CodePen:
https://codepen.io/anon/pen/KENaor
There must be at least one or more boxes checked but not necessarily all with a single error message.
Is it possible?
In what way.
Thank you for your reply.
The text was updated successfully, but these errors were encountered: