Forums

How to load a db record for display not edit

bashibosh 31 Oct, 2013
I'm a real newbie at php and chronoforms.
I've followed the tutorials for db record loading, so far so good, but have hit what I'm sure is a simply problem for you guys, but is a mystery to me.
The scenario is this: One form one I have used the DB Multi Record Loader and display a list of records. In the list I have a link to a second form for displaying the individual record data, the code linking to the second form is this:

<a href="index.php?option=com_chronoforms&chronoform=MTP_APP_Property_View_test&token=<?php echo $detail['cf_uid']; ?>">


The second form uses DB Record Loader, with DB Field = cf_uid and request Param = token
Now I'm stuck. I've tried a variety of PHP code snippets to try and display the record fields, but failed.
Including the Debugger in the form shows that the correct record is loaded, all I need to know is the correct way to display the data.

Any help would be most appreciated.
Thanks
John
GreyHead 04 Nov, 2013
Hi John,

If you look at the debugger output you can see the names of the variables that are being loaded.

To do a simple display go to the Preview tab, add a Custom Element element from the Advanced element group, open it up and add:
<div>
  Some text {input_name_1} some more text {input_name_2} . . .
</div>
Put a Show HTML action in the On Load event and test.

Bob
bashibosh 12 Nov, 2013
Thanks for the tip Bob, the variable I need is $form->data

Now I'm able to extract the date and display as a list

John
wnedoe 07 Feb, 2014
Hi!

Should this also work in CF5?

For me it does not :-(

I have a db_read action which works now after a lot of problems

So I have the following debug output

Array
(
[option] => com_chronoforms5
[chronoform] => examplaform
[exnr] => 6352
[exhibitors] => Array
(
[email] => foo@bla.com
[first_name] => eric
[name] => smith
[company] => supercompany
[id] => 6352
)

)


And want the first name and the name inserted in the header of the form

So I made a custom form element with {name} {first_name} according to the post above..
BUT

The output is :

Some text {name} some more text {first_name} . . and not the content of the fields.

Anyone any idea how to fix this or to do it right?

best regards
Alex
wnedoe 07 Feb, 2014
I found out how to display it after trying it with the curly brackets

<h2>Anfrage an <? echo $form->data['exhibitors']['first_name'] ." "; echo $form->data['exhibitors']['name']; ?> </h2>
<h3>Firma: <? echo $form->data['exhibitors']['company']; ?></h3>

this is the recommended way of doing it? not very beginner friendly.

regards
Alex
stephenfsnow 14 May, 2014
Unfortunately using the curly brackets in CF5 seems to no longer work. I can't seem to find any documentation on if there is now an alternative method or if it's just a bug.
Max_admin 15 May, 2014
Hi Stephen,

Where do you want to place the text ? in the form code or in a "Display message" text or.... ?

Please add a "Debugger" action before the target action and make sure that your fields names exist in the data array.

For example, for wnedoe the problem is that the data is under a sub array, and so in their case they had to use this format:
{exhibitors.company}


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.