EditI think I have things in the right spot in the settings side:But when I try things out I get:Parse error: syntax error, unexpected T_ENDFOREACH in C:\wamp\www\jobs\administrator\components\com_chronoforms\form_actions\custom_code\custom_code.php(17) : eval()'d code on line 10My form name is CompRef. The table in the database with the actual data is jos_chronoforms_data_comprefI can save to the table successfully using a separate form. Thanks a lot in advance."> Multi Record Loader help. - Forums

Forums

Multi Record Loader help.

hilltopper06 25 Jul, 2011
I am an admitted newb, and the Multi Record Loader tutorial seems straightforward enough, but I am not having success with it.

My Code:
<table>
<?php
foreach($form->data['CompRef'] as $detail);
?>
<tr>
<td>Name:<?php echo $detail['name']; ?></td>
<td><a href="index.php?option=com_chronoforms&chronoform=CompRef&token=<?php echo $detail['cf_uid']; ?>">Edit</a></td>
</tr>
<?php
endforeach;
?>
</table>


I think I have things in the right spot in the settings side:


But when I try things out I get:
Parse error: syntax error, unexpected T_ENDFOREACH in C:\wamp\www\jobs\administrator\components\com_chronoforms\form_actions\custom_code\custom_code.php(17) : eval()'d code on line 10

My form name is CompRef. The table in the database with the actual data is jos_chronoforms_data_compref

I can save to the table successfully using a separate form. Thanks a lot in advance.
GreyHead 26 Jul, 2011
Hi hilltopper06,

The error message flags a problem with the custom code. The foreach line needs to end in a colon, not a semi-colon:
foreach ( $form->data['CompRef'] as $detail ) :
Please see if that helps.

Bob
hilltopper06 26 Jul, 2011
That did it! Thanks a lot. I knew it was something trivial, but I was butting my head against the wall. Thanks again.
hilltopper06 26 Jul, 2011
I spoke too soon. It now displays my records, but when I click edit, it does not populate the fields with the data from the record. The URL shows the token information correctly, but none of the data passes. Any ideas?

Just to add some info. Load Fields is set to yes. I tried to set db field to cf_uid, but this causes "Empty Table!!!!!" to show up. So something isn't working there. Sorry again for what is most likely an oversight on my part when reading the tutorials.
GreyHead 27 Jul, 2011
Hi hilltopper06,

I'm not clear - do you have a DB Record load set up to populate the edit fields?

Bob
hilltopper06 27 Jul, 2011
Correct. I am pretty sure that i have done it the right way, and I am attempting to "token" cf_uid as shown in the single record load tutorial. But I am doing something wrong, because when I put cf_uid in the DB Field section, I get no results. Where I do get results without it (but the edit button on those results does not populate my data into the form). Thanks.
hilltopper06 27 Jul, 2011
Wait a minute, I think I just realized what you are saying. Do I need another form that handles the single record load/edit, separate from the multi record load form?

Edit:

Wow. I feel dumb, I totally misread the tutorials regarding the whole db_record load. It works now, thanks a lot!
GreyHead 27 Jul, 2011
Hi hilltopper06,

Great, glad you got it working.

For other readers: you do need a second form to handle the viewing or editing of individual records. The DB Multi-Record loader will create a list for you but can't, on its own, also handle the individual records.

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