I have a table of records created by Chronoform form - and I want to display them using the process defined in the tutorial on multi-record loader. I have set up a blank form and loaded the actions required as in the tutorial. I have inserted the following code in a custom code event after the multi-record loader event.
Here is the code
I also have used the debugger to show I am reading the records - here is the output
I get zero output - apart from the powered by notice - not even the table header. This must be a very basic problem I cannot see!
The table is MIForm, the model id is MIList.
I am on V4 of Chronoforms.
Here is the code
<table>
<thead>
<td>MI Listing</td>
</thead>
<tbody>
<?php
foreach($form->data['MIList'] as $detail);
?>
<tr>
<td>Member Number:<?php echo $detail['member_no']; ?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
I also have used the debugger to show I am reading the records - here is the output
Data Array:
Array
(
[option] => com_chronoforms
[tmpl] => component
[chronoform] => MIFormList
[Itemid] =>
[MIList] => Array
(
[0] => Array
(
[cf_id] => 1
[cf_uid] => b3354d1421098cf47d87bdf5f1466d34
[cf_created] => 2013-09-04 14:05:27
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 42
[cf_modified_by] => 0
[cf_ipaddress] => 86.29.90.69
[cf_user_id] => 42
[surname] => Ellis
[area] => Birkenshaw
[from_date] => 1600
[to_date] => 1900
[member_no] => 4066
)
[1] => Array
(
[cf_id] => 2
[cf_uid] => 10d7ba70fe3c79f30275125c299118ee
[cf_created] => 2013-09-06 12:42:58
[cf_modified] => 0000-00-00 00:00:00
[cf_created_by] => 42
[cf_modified_by] => 0
[cf_ipaddress] => 86.29.90.69
[cf_user_id] => 42
[surname] => Ellis
[area] => Heaton, Bradford(WRY)
[from_date] => 1750
[to_date] => 1830
[member_no] => 4066
)
)
)
Validation Errors:
Array
(
)
Debug Data
db_multi_record_loader
SELECT `MIList`.* FROM `MI_Form` AS `MIList`
I get zero output - apart from the powered by notice - not even the table header. This must be a very basic problem I cannot see!
The table is MIForm, the model id is MIList.
I am on V4 of Chronoforms.
Hi misterg2,
I think this line should end in a colon :
Bob
I think this line should end in a colon :
foreach($form->data['MIList'] as $detail);
Bob
From one grey head to another - thanks. Must get that php manual out again!
I have now managed to get the list to display but now trying to implement the link to the details form I have hit a problem with the code again. Here is the code
I have invested in the book but this is not an area that is covered.
<table>
<tr>
<td>MI Listing</td>
</tr>
<?php
foreach($form->data['MIList'] as $detail):
?>
<tr>
<td>Member Number:<?php echo $detail['member_no']; ?></td>
<td><a href="index.php?option=com_chronoforms&chronoform=MIForm&token=<?php echo &detail['cf_uid']; ?>">Edit</a></td>
</tr>
<?php
endforeach;
?>
</table>
The <a> tag line is causing the problem I believe but it appears OK - the table is accessed asSELECT `MIList`.* FROM `xnwi_chronoforms_data_MIForm` AS `MIList`
I have invested in the book but this is not an area that is covered.
Hi,
The href line does not work - when I remove it I get a list of three records which is the number in the data base - when I replace it no output. I still get the array loaded - can see that in the debug info. Most likely a scripting error.
The href line does not work - when I remove it I get a list of three records which is the number in the data base - when I replace it no output. I still get the array loaded - can see that in the debug info. Most likely a scripting error.
Hi misterg2,
Looking again that should be $detail['cf_uid'] not &detail['cf_uid']
Bob
Looking again that should be $detail['cf_uid'] not &detail['cf_uid']
Bob
This topic is locked and no more replies can be posted.