I am using the following jQuery validation plugin:
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I am trying to validate a nested array "tax_percents[]" which is inside another array. It only validates the first value in the array. The odd part is, for the second field in the array it kind of validates it and gives an error message in field 1.
Here is a live demo showing the error:
http://blastohosting.com/jquery_validate_array_error/
I have the following document:
<!DOCTYPE html>
<html>
<head>
<script src="jquery.min.js"></script>
<script src="jquery.validate.js"></script>
</head>
<body>
<form action="" method="post" id="theForm">
Location 1 Tax 1:
<input type="text" name="locations[1][tax_percents][]" />
<br /><br />
Location 1 Tax 1:
<input type="text" name="locations[1][tax_percents][]" />
<br /><br />
Location 2 Tax 2:
<input type="text" name="locations[2][tax_percents][]" />
<br /><br />
Location 2 Tax 2:
<input type="text" name="locations[2][tax_percents][]" />
<input type="submit" />
</form>
<script>
$("#theForm").validate({
rules:
{
"locations[1][tax_percents][]":
{
number: true
},
"locations[2][tax_percents][]":
{
number: true
}
}
});
</script>
</body>
</html>
What am I doing incorrectly?