DB Record Loader in Chronoforms5?

mbohunovsky 03 Jul, 2014
I am trying to implement a way for people to save and re-load a long form multiple times before they complete it (so their data isn't lost if their connection breaks or their computer goes down, etc. Since it might take them a long time to complete the entire form)

It looks like this would be possible via the DB save & load function. I am looking at:
http://www.chronoengine.com/faqs/61-cfv4/cfv4-tutorials/2698-how-to-load-one-row-from-a-db-table-into-your-form.html

However: The DB Record Loader action described here does not seem to exist in ChronoForms5. I do have a Db Read function but that one does not include anywhere the same settings as the DB Record Loader. Was this function dropped in ChronoForms5?

Again, what I want to do, ultimately:
1. An Admin first opens a form and enters a few basic fields. Then saves the form and gets a link to the ID of that specific form (on the backend the data is saved into a DB table)
2. He sends the link to the user.
3. The user opens the link and the fields already entered are loaded from the DB table
4. The user starts entering additional data and is instructed to regularly click the "Submit" button to save his data. The data is then saved into the same table row as previously.
5. Each time the user clicks "submit", he again gets the link to the form displayed and can get back to it by clicking it, so he can continue to enter data
6. When the user has filled the entire form he clicks "submit" one last time and does not return to the form.

Again, the above article looks like it would allow me to do just that, but I cannot find the "DB Record Loader" action. 😟

Thanks for any help.
GreyHead 04 Jul, 2014
Hi mbohunovsky,

Sorry for the delay in publishing this post.

In CFv5 the DB Read action in the Data Management action group is the one that you need.

Bob
mbohunovsky 04 Jul, 2014
Thanks,
But I can't figure out how to do this at all. Where are the "DB Field" parameters and the "Request Param", so I can have the url pass something like "token=...." to read the correct table row via the "cf_uid" field? Also, I simply want to read all the fields that the form has (after matching the row via cf_uid), it seems like I have to list all the fields I want to read? how do I match them to the table columns? The old function just automatically matched all fields with identical names.
Lastly, the old function had 3 events (on record found, on no rec. found, on no params passed)--where are these options now?

This looked very straightforward for DB Record Loader:
http://www.chronoengine.com/faqs/61-cfv4/cfv4-tutorials/2698-how-to-load-one-row-from-a-db-table-into-your-form.html
(maybe there is a similar tutorial for the new action?)

It looks like now I have to at least know php coding to achieve the same? (which I don't--I used to program jsp, asp, etc. but no php)

It looks like my best bet is still to use ChronoForms4. Does anyone know if I can install it alongside ChronoForms5 in Joomla 3.2?

Thanks
Max_admin 04 Jul, 2014
Answer
You can install CFv4, it should work fine with v5, v5 is defined in the system as "Chronoforms5", but v4 will be just "Chronoforms".

However, using "DB Read" is easy, just add this code in the conditions box:

<?php
return array("db_field" => $form->data["form_parameter"]);


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
mbohunovsky 04 Jul, 2014
So sorry. I still don't get it.
I have a simple form with 3 text fields:
date,registrar,lifegoal
I created a db save action and when I look at the database table, the only unique identifier I can find is "id" (there is a "uniq_id" field but it does not get automatically filled, so it is empty for all records)

So, I added a DB Read action before the html render action. I used:
<?php
return array("id" => $form->data("id"));
?>
...and left all other config fields at their default.

I also added a redirect action after the db Save action to redirect back to the form after submit and added "id=id" to the extra parameters, so the form is called with the id parameter and I would expect the load action then to add back the fields I just filled out into the fields of the newly displayed form. However: It doesn't. The fields are empty and nothing is loaded. (the db save action does however save the entered values correctly)

Thanks again for any help.
mbohunovsky 05 Jul, 2014
OK, it seems that it works now. I had to set the Model_ID parameter to "No" (...I wish I knew the meaning of "Model ID" or a place where I can look up what it means. Is it just another way to uniquely name form fields? Anyway...thanks for the help.
GreyHead 05 Jul, 2014
Hi mbohunovsky,

The Model ID is simply a way of putting the loaded data into a specific sub-array of the ChronoForms $form->data array where all of the current form data is stored. If you add a Debugger action to your form you can see what data is there and where it is saved (Note that with the DB Multi Record Loader there can be a lot of debug output!).

Bob
olaeblue 12 Jan, 2015
Hi

I'm having a similar problem. I had a loader working fine in C4 but in C5 I can't get it to load.

I am calling the right info

Array
(
    [option] => com_chronoforms5
    [chronoform] => HutBookingLimit
    [Data] => Array
        (
            [cf_id] => 1
            [latestdate] => 2015-12-31 00:00:00
        )

)


And Debug shows

Array
(
    [0] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `Data`.`cf_id` AS `Data.cf_id`, `Data`.`latestdate` AS `Data.latestdate` FROM `fv1lz_chronoforms_data_HutBookingLimit` AS `Data` WHERE `Data`.`cf_uid` = '90e7227465f69bf8ec01acc5f8c17c52'
                        )

                )

        )

)


But the date value is not writing into the datepicker called 'latestdate'.

Why not?

Thanks
Max_admin 13 Jan, 2015
Just set the option "read under model id" to "no", OR change the text box name to be Data[latestdate]

Moreover, for datepickers, the value must be in the same datepicker date format, so I suggest that you test this with a normal text box first, when it works you can test with the picker box.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.