Buy Now
Sign in

How to import the database ID in a field in chronoforms v5?

Channelsupport , December 28 2017
We use a registration form, made with Chronoforms v5. Applicants can enroll the form and we keep the results in our database. So far so good. Now, every form should have an unique number. Therefore we try to use the auto_increment field (ID) of the table from the database.
We don’t know how to import this ID in our form.

We use this php-code in a custom field of the form but no number appears:
// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

$query->where($db->quoteName('id')." = ".$db->quote($value));
$result = $db->loadResult();

Can someone give us advice about this?
Hi Channelsupport ,

If you are using the CF DB Save action to save the data then the new record ID is added to the $form->data array by ChronoForms - add a Debugger action temporarily to the form On Submit action so see where it is saved.


PS In your custom code it looks as if $value is not defined anywhere.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Thanks for your reply.
We received similar information via a colleague.
The import of the ID-number in a field in chronoforms succeeded!