Wednesday, March 6, 2013

Multirow form - add inputs with JS, but only the first ones gets submitted ...

I'm doing a CakePHP site, I have a form there, and the user should be able to add multirow inputs dynamically, with JavaScript. Let me simplify it: I generate the first input with this code:

echo $this->Form->input('Student.0.name');

So, when the user click on add more inputs - then I inject the HTML for this input - which is:

<div class="input required">    <label for="Student1Name">Width</label><input name="data[Student][1][name]" id="Student1Name" type="text">  </div>

The HTML, generated from the CakePHP code is equal to the other one - except the "0" and "1", we have sequent number here. But, when I submit - I have only the first input data on the server ... as the other ones have never been submitted.

What am I doing wrong?

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: