Re: Unlimited Inserts

2007-07-14 Thread Geoff Ford
I had it a bit wrong. It should be more like - note the Model in the newInsert array for ($i=0; $i < count($_POST['fieldName']); $i++){ $newInsert['Model'][fieldName] = $_POST['fieldName'][$i]; // do this foreach field $this->Model->create($newInsert); $this->Model->Save(); } @citrus - V

Re: Unlimited Inserts

2007-07-11 Thread citrus
What about validation? How can I handle it? On Jul 11, 5:51 am, Geoff Ford <[EMAIL PROTECTED]> wrote: > If every filed (or at least one of them) in the repeating region is > required then you can simply make the arrays (name="fieldName[]") and > then loop over them in the back end with > > for ($

Re: Unlimited Inserts

2007-07-11 Thread Chris Barna
Is there something special about foreach(). I modified it to use foreach() rather than just for(). It seems to loop through just fine but it saves over itself if there is more than one. foreach ($this->data["FieldName"] as $field) { $this->Model->create($field); $this->Model->save(); } On Jul 1

Re: Unlimited Inserts

2007-07-10 Thread Geoff Ford
If every filed (or at least one of them) in the repeating region is required then you can simply make the arrays (name="fieldName[]") and then loop over them in the back end with for ($i=0; $i < count($_POST['fieldName']); $i++){ $newInsert[fieldOne] = $_POST['fieldOne'][$i]; // do this foreach

Unlimited Inserts

2007-07-10 Thread Chris Barna
I have a form where I would like to allow a user to add as many values of one section as they want without having to reload the form. I'm imagining an ajax button on the bottom that will allow the user to just keep adding multiples of that section of the form. My question is, what would the best w