Display a completed form in an article

mburkart01 09 Jan, 2016
I have a number of trips that folks have entered using a form that I created. I am creating an article for each trip and I would like to display the form with the trip details in the article. I assume that I have to do more than use the Chronoforms plugin to load data into the form before calling the plugin.

{chronoforms5}TripData&ID=6{/chronoforms5}

How can I embed the form with data for the specific trip into an article?

Thanks,
...MIke
GreyHead 10 Jan, 2016
Hi Mike,

I'm not sure what you have in mind with 'data for the specific trip' - but if you add a DB Read action to the On Load event of the form then it can use the ID to get data from that record in a database table and include that in the form. Does that do what you need?

Bob
mburkart01 10 Jan, 2016
Bob,

I think what you suggested should work. I have a form I created to be able to edit data from a list I created in Connectivity, as described in the FAQ's. I've added the DB Read action in the On Load event prior to the Render action. The only thing I edited in the DB Read action is to add the table name and set Action Label to "load". Is there anything else I need to change?

In my article, I added {chronoforms5}TripData&id=6{/chronoforms5}

When I refresh my article page the form shows up without data.

Suggestions?
...Mike
GreyHead 11 Jan, 2016
Hi Mike,

Please add a debugger to the form ON Load event so that you can see what data is there. Using id may cause you problems with the plug-in as it can get confused with the Article ID if that is in the page URL

Bob
mburkart01 17 Jan, 2016
Bob,

Thanks, it looks like the ampersand in plug-in is getting replaced with &. I enter
{chronoforms5}TripData&d=6{/chronoforms5}

but the Joomla editor converts this to
{chronoforms5}TripData&id=6{/chronoforms5}


Please see the code/array below and let me know if this is the the problem.

I know I saw somewhere on this site a fix for this, but I can't find it again.

Here is the array info:
(
    [TripPreparationWorksheet-edit] => 
    [amp;id] => 6
    [id] => 9
    [uniq_id] => 
    [user_id] => 142
    [created] => 2016-01-10 16:20:16
    [modified] => 2016-01-10 16:45:26
    [TripTitle] => Fourth of July fireworks at St. Charles
    [RiverLake] => Missouri River
    [TripDate] => 07-04-2016
    [leader] => 
    [BoatInfo] => boats need to be 14 feet or longer with flotation front and rear.
    [HomePhone] => 
    [CellPhone] => 
    [Directions] => To get to ...
    [CarPoolingInfo] => We will meet at the commuter lot at Gravois and I 270 at 10:00 am
    [TakeOutInfo] => Riverfront Park St. Charles ....
    [Distance] => 20
    [RecommendedSkillLevel] => 1
    [LevelOfWater] => 0
    [ItemsToBring] => 
    [SpecialNotes] => We will eat dinner at a riverfront restaurant.
    [OverNightComments] => NA
    [button17] => 
)
mburkart01 18 Jan, 2016
Bob,

Thanks, that fixed the parameter passing issue but it did not fix the original problem.

Here is a snapshot of my screen, you can see part of the form that I've created but no data shows up in the form even though there is data in the Array. I'm passing an id=6 but the Array has [id]=9 instead of 6 and the SQL listed in the debug window does not include a where clause.

[attachment=0]Screen Shot 2016-01-18 at 12.03.22 PM.png[/attachment]

Array
(
    [TripPreparationWorksheet-edit] => 
    [id] => 9
    [uniq_id] => 
    [user_id] => 142
    [created] => 2016-01-10 16:20:16
    [modified] => 2016-01-10 16:45:26
    [TripTitle] => Fourth of July fireworks at St. Charles
    [RiverLake] => Missouri River
    [TripDate] => 07-04-2016
   ....
)


Debug info
Array
(
    [7] => Array
        (
            [DB Read] => Array
                (
                    [Queries] => Array
                        (
                            [0] => SELECT `Data`.`id` AS `Data.id`, `Data`.`uniq_id` AS `Data.uniq_id`, `Data`.`user_id` AS `Data.user_id`, `Data`.`created` AS `Data.created`, `Data`.`modified` AS `Data.modified`, `Data`.`TripTitle` AS `Data.TripTitle`, `Data`.`RiverLake` AS `Data.RiverLake`, `Data`.`TripDate` AS `Data.TripDate`, `Data`.`leader` AS `Data.leader`, `Data`.`BoatInfo` AS `Data.BoatInfo`, `Data`.`HomePhone` AS `Data.HomePhone`, `Data`.`CellPhone` AS `Data.CellPhone`, `Data`.`Directions` AS `Data.Directions`, `Data`.`CarPoolingInfo` AS `Data.CarPoolingInfo`, `Data`.`TakeOutInfo` AS `Data.TakeOutInfo`, `Data`.`Distance` AS `Data.Distance`, `Data`.`RecommendedSkillLevel` AS `Data.RecommendedSkillLevel`, `Data`.`LevelOfWater` AS `Data.LevelOfWater`, `Data`.`ItemsToBring` AS `Data.ItemsToBring`, `Data`.`SpecialNotes` AS `Data.SpecialNotes`, `Data`.`OverNightComments` AS `Data.OverNightComments`, `Data`.`button17` AS `Data.button17` FROM `zwe5f_chronos_TripPreparationWorksheet` AS `Data
GreyHead 19 Jan, 2016
HI Mike,

If the form is in an article then it's quite likely that you are seeing the article ID from the URL. I suggest that you change the plug-in parameter to something else - say cf_id. Then you can set the Conditions box in the DB Read to use something like
<?php
return array('id' => $form->data['cf_id']);
?>

Bob
mburkart01 31 Jan, 2016
Bob,

Your suggestion worked great to get the right data retrieved into the array. Now my only problem is that the data from the array does not load into the fields in the form. In the form under setup I have the DB read followed by the HTML Render form function. Any suggestion on what I need to change to get the data loaded into then fields on the form?

Thanks,
Mike
GreyHead 01 Feb, 2016
Hi Mike,

Please check that you don't have a Model ID set in the DB Read - without that the data should re-load automatically,

If that isn't the problem please add a Debugger action to the end of the On Load event and copy and paste the output here.

Bob
mburkart01 03 Feb, 2016
Bob,

I'm still getting the same results. According to the debugger, the correct data is being retrieved, but it is not getting into the fields.

This is private content



I have attached a couple of screenshots of the backend screens to help.

Thanks,
Mike
GreyHead 04 Feb, 2016
Answer
Hi Mike,

The data in the Debugger shows the Model ID 'Data' while the form is using the Model ID 'triplist' so the two don't get matched up. If you change the Model ID in the DB Read to triplist then it should work OK

Bob

PS Technically square brackets [] aren't permitted in HTML IDs (they are OK in names) and may cause you problems with JavaScript that tries to use the IDs.
This topic is locked and no more replies can be posted.