Hello! I am just getting started with Chronoforms8 and am quite pleased with the form construction and presentation. However, I am having trouble displaying the submitted data on the frontend in a list. I have followed the tutorial on the suggested page (https://www.chronoengine.com/faqs/chronoforms/chronoforms8/create-a-table-list-in-chronoforms8, which has allowed me to create an appropriate table, but all of the fields display as empty. I don't think the syntax is correct for the data being pulled from the database, but there isn't any documentation for the form alias' to text nodes setup.
I will provide an example of what I have setup:
On forms I have text fields for addresses; some of the fieldnames: pickup_address, pickup_city, destination_address, destination_city, etc...
On my list form, I have it setup to read the correct database and have selected columns for the information I want to display, using the code from the example.
I have Limit, Paging, and Sortable setup on the Read Data, and the table created:
The IDs of the submitted items show up in the table, but all of the data is blank. I suspect the data paths or shortcode is incorrect, but I could not find another example of loading the data from a form and could use some help.
Thank you.
Hi Keith
as per the tutorial you have referenced, you need to use {var:row.pickup_city}, not {data:...}, {data:} tags are for retrieving form fields values only
And you could have both the entry form and list in one form, as long as the pages have different pages groups
Thank you for your response. I will have to give that a try and see if I can get my menus to go to different pages of a single form then.
Unfortunately, changing the code from data: to var: didn't make any difference (and I did actually have it as var for some of the other fields. I probably made a mistake copying and pasting those shortcodes when I was experimenting to fix it). I added an HTML block to display those variables of the first ID, but it returned blank as well. I don't think the data is being accessed for some reason.
Turning on Debug, I can see that the Vars array is properly populated with the dataset. Here is a sample from the start of the array:
A thought occurred: the field names are not being stored in the array itself. Are they being cross-referenced automatically by the form id?
Are there any more pieces of the structure that I could post for you to help indicate where I might have the problem?
Thanks for your help.
Hi Keith
Since you are reading from the Log table, the whole list of fields are stored in a json object under the data column, in order to extract the data you need, you will need to add "data" to the Json Fields behavior in the Read Data:
that will extract the data as an array, then you will need to provide the path to each column, so in your table the "Data Path" would be something like
data.17
I think that should work, I did not try it before, but anyway you would not be able to have any "sorting" on this packed "data" column, if you need to have all the listing features then you will need to have a custom table to save the form data to and read from
So the fix to your code earlier would be {var:row.data.17} based on the field value you are trying to get
That did it! Now I can access it like a common array, using {var:row.data[i]}. A shame about losing sorting, but as I get more familiar with this structure, I might be able to add it later.
Thank you so much for your help! I think this will suit my site's needs well.
great, as I noted, you can sort when the table has a column for the field you are sorting, in this case you will need to move to a special table for this form
You can create a custom table using ChronoMyAdmin and use a "Save Data" action to save to that table