Howto dynamically load the DB records to display w/o coding

paramkrish 04 Jul, 2013
Hello friends, This must be something very simple but i could not locate the exact piece of code for any reference while browsing several topics. I dont want to do this through any PHP code since it must be something simple to acheive in Chronoforms i believe, looking at the options/rich-features that it gives.

Here is my requirement:
I have created a simple form, and a simple backend DB(MySQL) as well.
I want the table records to be dynamically populated as a list. I am using a model (Attendance).
Model_ID : Attendance, Form name : Attendance.

Qn: How do i show the value of these array fields as a list ?

I used a simple "textbox" , gave pretty much most values like "$form->data['cf_name']" OR Attendance.cf_name OR Attendance['cf_name'] nothing really shows the data.
I am missing something very simple i know. please help.

Qn: Can you help what must be given to the textbox options to these fields(refer screenshot)?
[attachment=0]1.png[/attachment]

Here is what the debugger say :
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => Attendance
)
Validation Errors:
Array
(
)
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => Attendance
[attendance] => Array
(
[0] => Array
(
[cf_name] => Shravan
[cf_attended] => 1
)
[1] => Array
(
[cf_name] =>
[cf_attended] => 0
)

[2] => Array
(
[cf_name] =>
[cf_attended] => 0
)

)

)
Validation Errors:
Array
(
)

Thanks
PK
GreyHead 04 Jul, 2013
Hi paramkrish,

To start with, in the boxes put just the name e.g. cf_name with no brackets, quotes or php stuff.

Bob
paramkrish 04 Jul, 2013
Thanks Bob for responding. I tried that too earlier, it did not help.
It throws the same value whatever i attempt to put in it.
[attachment=0]2.png[/attachment]

What is it i am missing ?
GreyHead 05 Jul, 2013
Hi paramkrish,

Ths Data Displayer tab in the DB Multi Record Loader will let you display a simple list of the records.

Bob
paramkrish 05 Jul, 2013
Bob, Thanks. I am aware of the Data Displayer but i would like to print these values directly with the simple form technique.

I noticed with "single DB Record Loader" your recommendation of "cf_name" works fine.

But for the multi, how do i display the array values in the same way ? I can see the array is intact as per debugger
Array
(
    [order] => cf_name
    [direction] => asc
    [attendance] => Array
        (
            [0] => Array
                (
                    [cf_name] => Shravan
                    [cf_attended] => 1
                )

            [1] => Array
                (
                    [cf_name] => 
                    [cf_attended] => 0
                )

            [2] => Array
                (
                    [cf_name] => 
                    [cf_attended] => 0
                )

        )

)
but just not sure how to get the value of the variables like "cf_name" etc., rather than using a php code or the data displayer.

PK
GreyHead 27 Jul, 2013
Hi paramkrish,

I would probably use PHP in a Custom Element element:
<?php
echo "<table>"
foreach ( $form->data['attendance'] as $v ) {
  echo "<tr><td>$v['cf_name']</td><td>$v['cf_attended']</td></tr>";
}
echo "</table>";
?>


Bob
This topic is locked and no more replies can be posted.