Welcome Guest, Not a member yet? Register   Sign In
Posting jquery cloned form fields.
#3

(08-09-2015, 08:16 PM)kilishan Wrote: I would guess it's the naming of your form inputs. You need to make sure that the form fields are named as an array. Something like:


Code:
   <input type="text" name="my_field[]">
   <input type="text" name="my_field[]">

That should come to your PHP script as an array that you can process as needed.

Actually I don't want the data to end up in an array or to have to serialize the data to put in the database, so I have the jquery script incrementing an index and appending it to the end of the name.  So it is like "my_field1" "myfield2" etc.  Then I have the actual columns in the database, and limit the number of duplicate fields to the number of columns.

Anyway I finally tracked down my problem.  I created a simplified version of the form with just the field being duplicated present, and all the cloned fields posted just fine.  So then going back through my orginal form, I found a stray </div> tag.  It was not causing any visual problems, because Firefox is so forgiving of html markup errors I guess, but apparently it was affecting the cloned fields presence in the DOM.
Reply


Messages In This Thread
Posting jquery cloned form fields. - by skribe - 08-09-2015, 07:58 PM
RE: Posting jquery cloned form fields. - by skribe - 08-09-2015, 10:02 PM
RE: Posting jquery cloned form fields. - by tony - 08-10-2015, 05:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB