Forums

how to save form data in a csv file

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 14 Jun, 2017
Hi Luca,

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

Best regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
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 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...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
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 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...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
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
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
lucadonati 19 Jun, 2017
Hi Bob,
thank you for your quick reply.

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