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.

1
  • Have you tried removing class="required" from the other two input boxes? Commented Jun 6, 2012 at 15:58

1 Answer 1

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>

?

Sign up to request clarification or add additional context in comments.

1 Comment

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 <?php $name = $this->input->post('name');// there is no issue with this line for ($i = 0; $i < sizeof($name); $i++) { echo $name[$i].'<br />'; } code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.