Hello,
please help me with following jQuery code. I'm javascript user only and I don´t understand it :(
I use jQuery validate from http://bassistance.de/jquery-plugins/jquery-plugin-validation/
Following part of code is modified for array form.
It works great for array in format: example[] .
But I need use array: example[$i][quantity].
//modified code
checkForm: function() {
this.prepareForm();
for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
if (this.findByName( elements[i].name ).length != undefined && this.findByName( elements[i].name ).length > 1) {
for (var cnt = 0; cnt < this.findByName( elements[i].name ).length; cnt++) {
this.check( this.findByName( elements[i].name )[cnt] );
}
} else {
this.check( elements[i] );
}
}
return this.valid();
},
//original code
/*checkForm: function() {
this.prepareForm();
for ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {
this.check( elements[i] );
}
return this.valid();
},
*/
Code from my PHP page:
<script language="javascript">
$().ready(function() {
// validate the comment form when it is submitted
$("#signupForm").validate({
rules: {
"example[]": "required"
},
messages: {
"example[]": "Fill it!",
}
});
});
</script>
Many thanks for any suggestion! Petr