ChronoEngine.com homepage

Forums

Please write a review for the extension you are using on the Joomla extensions directory before posting a new question as we are being spammed by many negative reviews.

Thank you for your support!

Upload contents of a form to CSV

hyperlast 02 May, 2019
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:
<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!
Max_admin 03 May, 2019
Hi,
โ€‹
Please check my post here

โ€‹
โ€‹
Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
hyperlast 08 May, 2019
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๐Ÿ™‚
GreyHead 08 May, 2019
Hi hyperlast,
โ€‹
Please check this post from the thread Max linked to.
โ€‹
Bob
hyperlast 08 May, 2019
Hey,
โ€‹
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?
healyhatman 09 May, 2019
return [ "first_field_name" => $this->data("first_field_you_want"), "second_field_name" => $this->data("second_field_you_want")];
hyperlast 09 May, 2019
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:
รฏยปยฟ
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]
Max_admin 11 May, 2019
It should be:
return [["first_field_name" => $this->data("first_field_you_want"), "second_field_name" => $this->data("second_field_you_want")]];
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 11 May, 2019
You can also use a "Data builder" action, add as many values as you need, they should be in this format:
Name: csv.0.title
Value: {data:field_name}
Then use {var:csv} as the data provider in the CSV action.
โ€‹
Best regards
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.

2Checkout.com

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com