Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
The webform clientside validation does not take the validation rule of "Require at least one of several fields" set by using webform validation module.
Comments
Comment #1
attiks CreditAttribution: attiks commentedCorrect, we didn't implement it and for the moment not much of free time. If you want/can you can always supply a patch to do this.
Comment #2
yang.wilby CreditAttribution: yang.wilby commentedyes, I want to supply a patch to do that. I have checked you codes both on server side and clientside. It seems that the logic for clientside is a little complex. I can make a clientside validation for at least one checkbox is checked in a group of checkboexes. but i do no know how to make it by extending your existing functionalites. can you give me a clue or some simple instructions. It is very kind of you to do so
Comment #3
attiks CreditAttribution: attiks commentedI won't be easy, jquery.validate doesn't support this out of the box, so you'll have to write a new validator method and tell the validator it's there (see Drupal.clientsideValidation.prototype.addExtraRules - checkboxgroupminmax), inside that rule you'll have to process all the elements defined in the rule on the server side and check if at least one is filled in.
I hope this helps ;p
Comment #4
yang.wilby CreditAttribution: yang.wilby commentedThank you for your instructions, now I have made it that the validation works for a group of checkboxes, but now I need to highlight the div which wrap the group of checkboxes, I do not know how to do that? can you give me a clue again? It is very kind of you to do so. the clientside_validation module is awesome and I am willing to contribute to it. I promise to supply the patch as it might be helpful If I have make it good enough.
Comment #5
attiks CreditAttribution: attiks commentedThe problem with highlighting the div is that you have to be sure that it's always there (in every possible theme), to get to the div you have to handle the display of the error manually and use jQuery to find the parent div, you can use errorPlacement to do this. see http://jquery.bassistance.de/validate/demo/milk/ for an example.
Comment #6
attiks CreditAttribution: attiks commented@yang.wilby any progress on this?
Comment #7
attiks CreditAttribution: attiks commentedComment #8
NWOM CreditAttribution: NWOM commentedHas there been any luck incorporating this into the 7.x-2.x branch? Or is this still not possible, just like the 6.x branch? Thanks in advance.
Comment #9
NWOM CreditAttribution: NWOM commentedIn this case, it also applies to the Field Validation module, rather than just the Webform Validation module, since Field Validation provides the same rule.