Loading a record into a form for editing

stikki 27 Nov, 2016
Hi

I am trying to follow the guidance on how to edit an item in a table, but my lack of understanding of what is going on, makes it hard for me to adapt a V4 tutorial and use it in V5.

I have created a form that loads the records from the table.
I have added custom code to put an edit button next to each row, so that when clicked it calls the new form and appends the uniq_id:
<a href="index.php?option=com_chronoforms5&chronoform=save-edited-timeslot&uniq_id=<?php echo $detail['uniq_id']; ?>">Edit</a>
This generates the correct url and loads the update form, but whatever I try, the update form only loads the very first record in the table.

The update form has a DB read control, which is set to single record, the model ID is turned off and I have put the parameter uniq_id in the parameter box.

But the form always loads with the first item in the table.

I have tried loading all the records and the debugger show them all, but then none of the record details are loaded onto the fields, so I guess putting uniq_id in the parameters box is not doing the trick?

Can anyone help me with this please?

Thanks

Mikki
Max_admin 27 Nov, 2016
Hi Mikki,

Did you test ChronoConnectivity ? please check the FAQs section on CCv5 because it will help you do this mush easier than using Chronoforms alone.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 27 Nov, 2016
Hi Mikki,

You need to add an entry in the Conditions box of the DB Save to use the uniq_id to identify the record
<?php
return array('uniq_id' => $form->data['uniq_id']);
?>


If you drag a Debugger action into the On Submit event you should be able to see the MySQL query that is being created and check that is correct.

Bob
stikki 27 Nov, 2016
Thanks Max I will have a look at that.

And thanks to you as well Bob - that really helped me out.

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

VPS & Email Hosting 20% discount
hostinger