Hi,
Just started using Chronoforms and been struggling in the past days to show all data from a given table on a form.
In "Setup" I drag a "DB Reader" to the "On Load" Event, but can't seem to find the way to show the data I'm retrieving from DB.
Can anyone give me a detailed HOWTO?
Regards,
Bruno
Just started using Chronoforms and been struggling in the past days to show all data from a given table on a form.
In "Setup" I drag a "DB Reader" to the "On Load" Event, but can't seem to find the way to show the data I'm retrieving from DB.
Can anyone give me a detailed HOWTO?
Regards,
Bruno
Hi Bruno,
In ChronoForms v5 there is no built in data lister action. You can do it using PHP in a Custom Code Element in your form if you need to. The easier solution is to use ChronoConnectivity which is designed as a data lister. Please see the FAQs for a starter tutorial.
Bob
In ChronoForms v5 there is no built in data lister action. You can do it using PHP in a Custom Code Element in your form if you need to. The easier solution is to use ChronoConnectivity which is designed as a data lister. Please see the FAQs for a starter tutorial.
Bob
Thanks for the fast reply Bob.
Any tutorial with Custom PHP Code example?
Meanwhile, I'll try ChronoConnectivity.
Regards,
Bruno
Any tutorial with Custom PHP Code example?
Meanwhile, I'll try ChronoConnectivity.
Regards,
Bruno
Hi Bruno,
In a ChronoForms Custom code element use a PHP foreach loop to cycle through your data and display a table row each time. So if your data is in $form->data['my_data'] and you have columns 'id' and 'name' it would be something like this:
In a ChronoForms Custom code element use a PHP foreach loop to cycle through your data and display a table row each time. So if your data is in $form->data['my_data'] and you have columns 'id' and 'name' it would be something like this:
<?php
echo '<table>
<tr><th>ID</th><th>Name</th></tr>';
foreach ( $form->data['my_data'] as $d ) {
echo "<tr><td>{$d['id']}</td><td>{$d['name']}</td></tr>";
}
echo '</table>';
?>
Of course you can add more formatting and more columns as needed.
This topic is locked and no more replies can be posted.