Hi. I needed a form that would allow users to dynamically add fields so I've adapted this jquery solution http://sroucheray.org/blog/demos/jquery-dynamic-form. The form itself works great but I can't seem to figure out how to properly save the data to a database table. I know next to nothing about java but I'm guessing the problem has to do with the field names being dynamically generated. If anyone can offer a solution, I'd be extremely grateful. Thanks for your time.
joe
joe
Hi joe,
Hmmm . . . if you know what the input names will be you can add them into the database table manually. Hard to say any more without seeing what the code actually produces.
Bob
PS JQuery may well cause problems with other ChronoForms features unless you set it into no-conflict mode.
Hmmm . . . if you know what the input names will be you can add them into the database table manually. Hard to say any more without seeing what the code actually produces.
Bob
PS JQuery may well cause problems with other ChronoForms features unless you set it into no-conflict mode.
Hi Bob. Thanks for the quick response. The example I'm using from that page is #duplicate3 (Multiple fields duplication). The form allows the user to enter their first and last name followed by their address. Then, it allows them to add another set of address fields to enter multiple addresses. Interestingly, the javascript assigns new input ids for each new set, but the input names remain the same.
In other words, the first set of input ids are:
address0
postal1
city2
The ids for the duplicated set are:
address3
postal4
city5
The input names, however, are all the same:
adr[]
postal_code[]
ville[]
Based on what you've said it seems the solution would be: 1) edit the javascript file <http://sroucheray.org/demo/jquery-dynamic-form/jquery-dynamic-form.js> to ensure that all dynamically generated fields are assigned unique names; then 2) add the names to the database table manually.
Is this correct?
In other words, the first set of input ids are:
address0
postal1
city2
The ids for the duplicated set are:
address3
postal4
city5
The input names, however, are all the same:
adr[]
postal_code[]
ville[]
Based on what you've said it seems the solution would be: 1) edit the javascript file <http://sroucheray.org/demo/jquery-dynamic-form/jquery-dynamic-form.js> to ensure that all dynamically generated fields are assigned unique names; then 2) add the names to the database table manually.
Is this correct?
Hi joe, I found your post and have been trying to make jquery work in my form without success. Could you be so kind to attach the javascript you used to get the form working? Thanks in advance.
Sure. I used a jquery form designed by Stephane Roucheray. You can download a complete zip file (containing the javascript, html, and jquery library files) at: http://code.google.com/p/jquery-dynamic-form/downloads/list
For a demo of the form, check out: http://sroucheray.org/blog/demos/jquery-dynamic-form/
I used this javascript code as is and it seems to work fine. The main problem (at least for me) is figuring out how to email and store the dynamically generated data.
joe
For a demo of the form, check out: http://sroucheray.org/blog/demos/jquery-dynamic-form/
I used this javascript code as is and it seems to work fine. The main problem (at least for me) is figuring out how to email and store the dynamically generated data.
joe
This topic is locked and no more replies can be posted.
