Hi to all,
I'm creating a multipage form, and in the second page I created a set of inputs (up to 99 sets) following the "add - one" method suggested by Bob. Now I have some questions about how to handle data.
I wish to create a table (or a .csv file) which contains both data got from first and from second step; I wish also to send email confirmation with all data. How can I do it?
Thanks to all
Davide
Hi davidakis,
I don't know what you expect this to do. I suspect that once you change the header ChronoForms loses control. And why would you send an HTML table to an Excel file?
Bob
I would like to process my data in order to give the user the possibility to save an .xls (or .csv, or whatever) file on his desktop with all the results; I would also like to send a mail with the same data. Actually I corrected 'the semicolon mistake', but the form behaves the same way: neither it sends the email confirmation, nor it saves any file. It only saves the 'first page' data in a DB, by using the DB Save action.
ps.: In effect after submitting the second page, the result is that: form reloads the second page with all 99 sets of input... So I think you're right, and I think I'll try another method.
About Email: My user is configured with no editor, while on Global settings I chose one.
I don't know how to use it with my Custom element made of x sets of input...
Hi Davidakis,
You can use PHP to put your data into a flat array in the $form->data array - which you will need for a CSV export, then use the Data Path entry in the CSV Export [GH] action to point to that entry. It should work OK as long as the data sets aren’t enormous.
How do you want the data to appear in your spreadsheet? That will determine how you structure the flat array i.e. what are the column and row headers?
Bob
Actually the columns are:
"Cognome" (i.e. Surname)
"Nome" (i.e. Name)
"Anno" (i.e. Year, intended as birth year)
"Nazionalità" (i.e. country of origin, selected by a dropdown menu)
"Sesso" (i.e. gender, selected by radio button)
There is no row header, but this could be made simply by putting an ID number for any row, as I don't know how many rows a customer will complete. (It could be up to 99).
So, doing a summary, my CSV file should appear as follows:
'first step data' -> one field, one row
'second step data' -> one set of fields, one row
Ok Bob,
I'm going to try to solve my issue in one of these ways:
1 - exporting in .xls, that should permit to respect my layout;
2 - formatting 'first step data' in the same way as 'second step data' as they could be displayed in five columns.
I'll let you know if I need more help.
Thanks a lot
Davide
I decided to turn multipage form in a 'tabbed form' using container. Now I have only to configure correctly my "On Submit" actions. 'First Step data' are saved in a DB, 'second step' are in arrays (Custom element with 'add one' method). I dragged the CSV Export (v 2.0 GH) action, but I don't know how to configure it for the custom element (each field has got is own array).
Thanks
Davide
Good news: at last I solved all my issues by using containers, creating tabbed form, and exporting my data in a .csv file created by means of custom code. I was able, also to customize my Email Template, including both "first step" and "second step data" with a little php snippet inside the template box.
As this is "how to" section (I wrongly used it to pose questions) I think it'll be useful to update this post, rename it and eventually post my "how-to"🙂
Thanks far all support
Davide
Hi davidakis,
If you compare your results with my example then you should see the problem. You want the data to export in a structured sub array.
Bob
Hi Bob, actually I have two types of data: the first is 'group data' which is email, sports society name, and so on; the second is a list of individuals who are part of this group. At last I need to save all my data in a file, and my problem was distinguish the group from the list of individuals.
If I got clearly I could get both 'group data' and 'list of individuals' by using your Csv export action and setting the table for the 'group', then writing $form->data['user_data'] in the Data Path box.
Thanks
Hi davidakis,
I think that a single CSV file can only contain a single data structure so you'd have to use two separate actions to export two files. Or you could look at using a PHP Excel library to create an Excel file with the compound layout.
Bob
Hi Bob,
Eventually I realised I need my csv file only as an administrator: this gives to me the opportunity to download each file without copying the text of every mail message. I send to users a confirmation mail with both 'group data' and 'list of individuals'; the data in it are viewed in a compound way (as I need). I did that by a little PHP snippet inside the email template.
This way users have a kind of "bill" of their submission, in their mail message. That was what I wanted to do for users.
I get my csv file by processing data with Custom Code.
Thanks a lot for all your support.
Davide
Hi Davide,
Great - sounds as though you have it all working well enough :-)
Bob