Forums

SubmitContent form for multiple records

jbudd 03 Mar, 2009
Is it possible to create multiple records from a single form based on SubmitContent?

The school site I manage gives children gold, silver and bronze awards which are recorded as individual pages containing just the child's name

eg Section Awards, Category Bronze, Content Item contains John Smith.

I would like to have a single form with a repeated "Name" input field but only one "Submit" button so that they can create several bronze award records in one go.

Is this possible with Chronoforms? Can you give me any pointers on how to modify the form code to achieve it please?

Thanks,

jb
GreyHead 03 Mar, 2009
Hi jbudd,

I think you'd have to amend the form quite a lot to do this - but I'm sure that it is possible.

Bob
Max_admin 03 Mar, 2009
Hi jbudd,

you need an array of fields using : name="name[]", loop through them and use the autogenerated code to insert records!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jbudd 03 Mar, 2009
Thanks for the replies.
I'll have to dive in to the autogenerated code and try and understand how it works!
Max_admin 03 Mar, 2009
if you have multiple names ONLY then no diving, just a loop and copy and paste the auto generated code inside it (you will change the name variable for each iteration), but if other fields will change too then you will change more than the name variable!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jbudd 04 Mar, 2009
Just to check I understand what you have suggested:

In the Form Code (it has to be in the after sending email section?):

loop through my input fields
{
build $_POST structure,
code copied from AutoGenerated Code to write a record.
}

Well it seems to work, only except that I get a duplicated record of the final iteration because the AutoGenerated code is still there. If I delete it, saving the form restores it.
Max_admin 05 Mar, 2009
well, yes, you can't delete it, try to loop until the count of the POST array - 1, this should do it!🙂

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jbudd 02 Feb, 2010
Hi again!

This form has been working until just recently, then it ceased to post records (except for the first one).

I have identified the trouble:

Autogenerated code now has
if($MyForm->formparams("dbconnection") == "Yes"){
while my code (copied from autogenerated code as it used to be) has
if($MyForm->formparams->dbconnection == "Yes"){

I would like to find out when and why the autogenerated code changed. Could it be related to a recent move to a different hosting company with different PHP/MySQL versions, or a Chronoforms update?

It seems that this method of posting multiple records is rather fragile. Have you developed a better way to achieve it?

Thanks,
jb
This topic is locked and no more replies can be posted.