2

I already read this thing on jQuery validation but still I'm stuck with this requiring control array in the form.

I have this code:

//already link the validation js script of course

<scrip>
    $(document).ready(function() {  
    $("#hh").validate();
    });
</script>

<form id="hh">
<input type="text" name="name[]" class="required" /><br />
<input type="text" name="name[]" class="required" /><br />
<input type="text" name="name[]" class="required" /><br />
<input type="submit" name="Submit" />
</form>

The problem is, the first row of control named 'name[]' is required the rest is nothing. I already make update to checkForm: function() on jquery.validate.js as what the this link says but its nothing...

Adding class="required" to every controls is working for me actually, but I'm stuck with this control array thing...

Can anybody please submit a step by step on how to solve this problem? A very simple lines on code that already working is a good help; Like modifying the code I posted above.

I'm sorry I'm already frustrated with this thing.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

0

How about this:

<form id="hh">
<input type="text" name="name[0]" class="required" /><br />
<input type="text" name="name[1]"  /><br />
<input type="text" name="name[2]"/><br />
<input type="submit" name="Submit" />
</form>

?

wroniasty
  • 7,884
  • 2
  • 32
  • 24
  • Thanks, but the name[0], etc. wont accept using my code on PHP post request.. I think the array of my code is out of bounds.. like this in codeigniter.. `code` input->post('name');// there is no issue with this line for ($i = 0; $i < sizeof($name); $i++) { echo $name[$i].'
    '; } `code`
    – Dave Suarez Jun 07 '12 at 02:17