dilvie/h5Validate — pull request #39 by joelpurra (2012-05-12 22:15:01+00:00)
Title: Validate all radio button with the same name

This patch fixes radio button validation by validating all radio buttons with the same name (in the same "group") as the current one being validated.

I disagree with the previous fix (see issue #27); I believe that it does not fix the problem. See [pull request #38 "Updated the faulty test for issue #27"](https://github.com/dilvie/h5Validate/pull/38) for an updated test that explains the failing code.

I have kept the [original test for issue #27](https://github.com/joelpurra/h5Validate/blob/ba03859e88f28765d892e0c86727453e445965ec/test/test.h5validate.js#L138). It still passes, but should be patched as it doesn't test validity on all radio buttons in a group being validated.

### Performance note ###
If anyone is concerned with performance, there might be a better way to perform validation (or just retreive an existing validation result) from the other radio buttons in the same group. Right now each call to validate will trigger validation for the other radio buttons - if there are 3 radio buttons, that means 3 validations. If all 3 radio buttons are being inspected for validation that will mean 9 validations (3 squared). Examples include an externally implemented loop (`$myFields.each(....h5Validate('isValid')`) or in `allValid`. If you have 10 radio buttons, such a loop would mean 100 validations. It should be possible to, for example, internally in `allValid` filter out multiple radio buttons in the same group and just validate one.