I am very "green" to chronoforms. But, after days of trying to figure this out (reviewed tutorials and scoured forums), am willing to buy two beers for any assistance! 😀
I'm trying to pull fields from the registration table (CF registration)
. In the preview pane, I have the field name proper labeled lastname (for example). However, when I go to the form, nothing is populating. I'm sure I'm missing something, but since I'm on v4 I'm having difficulty finding more examples in the forum.
What am I missing? I really appreciate your help!
I'm trying to pull fields from the registration table (CF registration)
![[SOLVED] Auto Fill - DB Record Loader image 1](cfdbload.png)
What am I missing? I really appreciate your help!
Hi,
Your configuration looks fine, but in order for this action to load data, you will have to pass a valid record cf_uid under a parameter called "token".
e.g: index.php?option=com_chronoforms&chronoform=dynamic_dropdown&token=111111111113123213123213
Are you doing this correctly ?
Regards,
Max
Your configuration looks fine, but in order for this action to load data, you will have to pass a valid record cf_uid under a parameter called "token".
e.g: index.php?option=com_chronoforms&chronoform=dynamic_dropdown&token=111111111113123213123213
Are you doing this correctly ?
Regards,
Max
Hi mduda ,
Please try adding this code into a Custom Code action before the DB Record loader:
Bob
Please try adding this code into a Custom Code action before the DB Record loader:
<?php
$user=& JFactory::getUser();
$form->data['token'] = $user->id;
?>
Note using 'token' here is arbitrary - you can use any label provided that it matches the entry in the Request Params box of the DB Record Loader action. Bob
GH - with your clarification on the "token", I was able to get it to work! Thanks! However, I'm unclear on where the data is actually being pulled from. The table is a registration form created in CF. I have the name field broken up - "lastname" and "firstname". But, I'm unable to pull either of these from the table. I am able to pull "name" - since Joomla uses "name", I have to assume that it's pulling from the joomla user table? Any ideas on how I can get the actual fields from the CF Registration form?
Thank so much!
Thank so much!
Hi mduda,
The DB Record Loader will load data from whatever table you have in the settings. Use a Debugger action to see exactly what is there.
The two lines of code I posted get the Joomla! User Object which does come from the jos_user table. But you only need the User ID from that to identify the correct record in your table.
Bob
The DB Record Loader will load data from whatever table you have in the settings. Use a Debugger action to see exactly what is there.
The two lines of code I posted get the Joomla! User Object which does come from the jos_user table. But you only need the User ID from that to identify the correct record in your table.
Bob
I still don't have it! Ugh. Let me post what I have, and please tell me in layman's terms what I'm missing. I truly appreciate your time! (and patience🙂
[attachment=1]cfcode.png[/attachment]
[attachment=2]cfload.png[/attachment]
[attachment=0]cf.png[/attachment]
[attachment=1]cfcode.png[/attachment]
[attachment=2]cfload.png[/attachment]
[attachment=0]cf.png[/attachment]
Hi mduda,
I'm sorry, there was a typo in the code I posted :-)
$user_id should be $user->id
I fixed my original post
In your images:
1) the mode should be 'controller' instead of 'view'
2) I find it a bit odd that your call the 'user ID' parameter 'email' but it will work OK as long as you are consistent.
Bob
I'm sorry, there was a typo in the code I posted :-)
$user_id should be $user->id
I fixed my original post
In your images:
1) the mode should be 'controller' instead of 'view'
2) I find it a bit odd that your call the 'user ID' parameter 'email' but it will work OK as long as you are consistent.
Bob
GH - thanks for getting back to me so quickly. I'm ready to pull my hair out😟 I can not figure out what I'm doing wrong here.
I changed the view to controller and adjusted the custom code. The fields are not populating on the form.
I changed the view to controller and adjusted the custom code. The fields are not populating on the form.
Got it!!! Thank you so much!!! Will buy you two beers when I wake up tomorrow am!
After some trial & errors I've got my form correctly reloaded with the original data filled in.
Unfortunately when I change any data and hit the submit button the old record is not overwritten, but a new record is made.😟 How do I get the old record data revised🤨
Unfortunately when I change any data and hit the submit button the old record is not overwritten, but a new record is made.😟 How do I get the old record data revised🤨
Hi KarelMG ,
You need to make sure that the primary key value for the record that you want to update is included in the form data. Usually you'd do this by including it in a hidden input in the form. For example:
How you add the value will depend on how you are calling the edit. If it is in a URL then ChronoForms will set it for you.
Bob
You need to make sure that the primary key value for the record that you want to update is included in the form data. Usually you'd do this by including it in a hidden input in the form. For example:
<input type='hidden' name='id' id='id' value='999' />
How you add the value will depend on how you are calling the edit. If it is in a URL then ChronoForms will set it for you.
Bob
Hi Bob,
Thanks for your quick response
In the mean time I found on the forum the solution that works.
I have added a Hidden Box in the Show HTML with the following configuration:
Label Text: cf_id
Field Name: cf_id
Field Default Value: <?php echo $form->data['cf_user_id'] ?>
Regards,
Karel
Thanks for your quick response
In the mean time I found on the forum the solution that works.
I have added a Hidden Box in the Show HTML with the following configuration:
Label Text: cf_id
Field Name: cf_id
Field Default Value: <?php echo $form->data['cf_user_id'] ?>
Regards,
Karel
Karel, thank you for posting this - this worked for me also.
I've added your notes using Okular (useful for adding notes in Ubuntu system).
Cheers.
BionicNelly
I've added your notes using Okular (useful for adding notes in Ubuntu system).
Cheers.
BionicNelly
This topic is locked and no more replies can be posted.