how to save form data in a csv file

How to save form data in a CSV file without extra rows or headers.

Overview

The issue occurs when the CSV action includes unwanted header rows or system data instead of only the submitted form fields.
Use a PHP action to return the form data, then reference it in the CSV action's data provider. Disable the header titles setting in the CSV action to output a single clean row of data.

Answered
ChronoForms v6
lu lucadonati 14 Jun, 2017
Hi,
in a contact form I set a csv file and I successfully attached it to the email but I don't know how to include the submitted data in it.

The csv file I received contains:

"4,test-form,test-form,1,1,,Array,Array,Array,Array,Array,Array,Array"

I should like to receive only the submitted data as name, email, subject an so on.
Could you explain me how?

Thank you

Luca
Max_admin Max_admin 14 Jun, 2017
Hi Luca,

In the "Data provider" please add {data:}

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lu lucadonati 15 Jun, 2017
Hi Max,
I tried several conbination (one file attached) but the csv file I get is empty.
I'm not a coder, could you tell me the exact syntax to insert several field data in the "Data provider"?
Do I miss something else?

Thank you

Luca
Max_admin Max_admin 15 Jun, 2017
Hi Luca,

All your settings were correct, only the "Data provided" had to be set to {data:}

But, I think that this might not work as expected too, since the CSV expects a data list, do you need to create a CSV file with only 1 row of data ?

If this is the case then you will need a PHP action before the CSV and use this code:
return [$this->data];


Then in the CSV data provider: {var:php_name}

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lu lucadonati 16 Jun, 2017
Hi Max,
yes, I need to create a CSV file with only 1 row of data.

I tried your solution and I got a file containing the following 2 row:

option,chronoform,event,name,cognome,email,subject,message,autorizzo,secicon10,button9,Itemid
com_chronoforms6,test-form,submit,"First name","Last name",email@domain.ext,"Test form",Message...,1,5943ba9ee5645,,

As I said the best for me will be 1 row of data, the first row should not be there, is it possible?

I did some tests and I could get a file with 1 row of clean data:

1. I set CSV action as in setup_1.png attached and I got a file containing the following 2 row:

"Last name","First name",email@domain.ext,"Test form 2",Message...
6,test-form-2,test-form-2,1,1,,Array,Array,Array,Array,Array,Array,Array

2. I inserted in the "Data provided" the text "name" (see setup_2.png attached), I think it is wrong instruction but probably it prevents the second row to be included in the CSV file, so I got just 1 row of clean data:

"Last name","First name",email@domain.ext,"Test form 3",Message...

What you think about it?

Thank you

Luca
Max_admin Max_admin 18 Jun, 2017
Hi Luca,

I have added a new setting to disable the first line of header titles, please send me a message using the Contact us page to get the file and test it.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lu lucadonati 19 Jun, 2017
Hi Max,
yes, this is enough for my project.
Will you include the new setting in the next ChronoForms v6 release?

One last question, I should like to attach the csv file only to my client and not to the person who submit the form, can I just use 2 different email actions to handle it?

Thank you

Luca
Gr GreyHead 19 Jun, 2017
Answer
Hi Luca,

Yes you can use two different email actions to send different emails to the client and the user.

Bob
lu lucadonati 19 Jun, 2017
Hi Bob,
thank you for your quick reply.

Luca
This topic is locked and no more replies can be posted.