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

attiks’s picture

Category: bug » feature

Correct, 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.

yang.wilby’s picture

yes, 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

attiks’s picture

I 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

yang.wilby’s picture

Thank 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.

attiks’s picture

The 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.

attiks’s picture

Status: Active » Postponed (maintainer needs more info)

@yang.wilby any progress on this?

attiks’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
NWOM’s picture

Version: 6.x-1.19 » 7.x-2.x-dev
Issue summary: View changes
Status: Closed (works as designed) » Active

Has 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.

NWOM’s picture

Title: The webform clientside validation does not take the validation rule of "Require at least one of several fields" » Compatibility with "Require at least one of several fields" validation rule

In this case, it also applies to the Field Validation module, rather than just the Webform Validation module, since Field Validation provides the same rule.