rickharrison/validate.js

Only first radio button set validated

parker411 opened this issue · 2 comments

Issue:
Only the first of the two items is validated. If I flip the crane and scaffold config around, it still uses which ever one comes first.

Using Chrome 56.0.2924.87 (64-bit) and IE11

code:

...
    rules: 'required|numeric'
}, {
    name: 'scaffold',
	display: 'Scaffolding Erected',
    rules: 'required'
}, {
    name: 'crane',
	display: 'Crane in Use',
    rules: 'required'
}, {
...

and

				<div class="formContainer">
					<label>Is Scaffolding being erected within 4 Mtrs?</label>
					<div class="radioContainer">
						<label for="scaffold1">Yes</label>
						<input type="radio" name="scaffold" id="scaffold1" value="y">
						<label for="crane2">No</label>
						<input type="radio" name="scaffold" id="scaffold2" value="n">
					</div>
				</div>
				<div class="formContainer">
					<label>Are Cranes or Mobile plant being used?</label>
					<div class="radioContainer">
						<label for="crane1">Yes</label>
						<input type="radio" name="crane" id="crane1" value="y">
						<label for="crane2">No</label>
						<input type="radio" name="crane" id="crane2" value="n">
					</div>
				</div>

I've the same problem. When using 2 sets of radios, only the first ist validated.
See: https://jsbin.com/demicotapu/1/edit?html,js,console,output
Only if the first radio button is valid the error message of the second is shown.
Any help appreciated!

Thx in advance

I read a view more and found pull request #183 from beijaflor who solved this problem.
Thx @beijaflor!
@rickharrison Is there a reason I don't see, why you don't pull beijaflor's fix? Beside that: Thx for your work, great stuff!