Hi guys,
Really happy with Chronoforms so far! I am building a candidate registration form using Wordpress on the latest build of CFv6, with every submission I want a CSV file to be generated with candidate details so it can then be taken over by our main DB and put into the system. I have a CSV on-submit function, the CSV gets generated, however, inside it there's only the following error:
Data gets inserted into the website database just fine. I have left the 'Data Provider' field empty as I have not a clue how to fill it out. Looking at different topics on the forum I have tried {var:read_data#.[n].model} which doesn't help. I am very much fresh to website development, php and sql so I will need quite a thorough explanation😉
Thanks for your help!
Really happy with Chronoforms so far! I am building a candidate registration form using Wordpress on the latest build of CFv6, with every submission I want a CSV file to be generated with candidate details so it can then be taken over by our main DB and put into the system. I have a CSV on-submit function, the CSV gets generated, however, inside it there's only the following error:
<b>Warning</b>: fputcsv() expects parameter 2 to be array
Data gets inserted into the website database just fine. I have left the 'Data Provider' field empty as I have not a clue how to fill it out. Looking at different topics on the forum I have tried {var:read_data#.[n].model} which doesn't help. I am very much fresh to website development, php and sql so I will need quite a thorough explanation😉
Thanks for your help!
Thanks Max! I tried that method before on XAMPP which didn't work but now on a proper hosting it does the job just fine. Is there a way to manipulate the CSV output? I am looking to delete specific fields (first four columns generated in the CSV file are 'page', 'cont', 'chronoform' and 'event' which are not present in the data table itself) and rearrange the order of columns in the csv.
Thanks once again for your help🙂
Thanks once again for your help🙂
Hey,
Sorry to be a pain, as I said I am very much a beginner. I have the PHP action set to
Sorry to be a pain, as I said I am very much a beginner. I have the PHP action set to
return [$this->data];and data provider set as {var:csv_data} in the CSV action. Which fields do I need to modify and in what way in order to only select specific fields to be imported to CSV?
return [ "first_field_name" => $this->data("first_field_you_want"), "second_field_name" => $this->data("second_field_you_want")];
Thank you healyhatman, I feel like we're closer than ever haha : ) I adapted the PHP action to my fields, now the debugger correctly recognizes the array and returns only the fields I want. The only problem is now the CSV file only contains:
Debugger:
[file=12198]CSVaction.PNG[/file]
[file=12199]CSVdata.PNG[/file]
I checked if the naming is correct and everything seems to be just fine. Any ideas?
Debugger:
Array ( [validate_fields2] => Array ( [log] => Automatic validation enabled. [var] => 1 ) [csv_data] => Array ( [returned] => Array ( [firstname] => FirstSample [secondname] => SecondSample ) [var] => Array ( [firstname] => FirstSample [secondname] => SecondSample ) ) )
[file=12198]CSVaction.PNG[/file]
[file=12199]CSVdata.PNG[/file]
It should be:
return [["first_field_name" => $this->data("first_field_you_want"), "second_field_name" => $this->data("second_field_you_want")]];
You can also use a "Data builder" action, add as many values as you need, they should be in this format:
Best regards
Name: csv.0.titleThen use {var:csv} as the data provider in the CSV action.
Value: {data:field_name}
Best regards
This topic is locked and no more replies can be posted.