Forums

Problem: Can't load data to form based on user logged in

nhinzky 01 Oct, 2014
Hi guys,

I am new to chronoforms and it's kind a great component and lots of features. I have a problem loading the data base from user who is logged in. I have created a form and a table for the form. I can't load the data entered after successful form submission. I have read the FAQ but I can't get it to work. Please help.

Thanks.
GreyHead 01 Oct, 2014
Hi nhinzky,

What code are you using to get the User ID?

What do you see when you add a Debugger to the form On Submit event?

Bob
nhinzky 02 Oct, 2014
Hello,

Thanks for the reply. This is the code I added in conditions box: and this:

I also add a debugger just like what you suggest but I can't see any logs on screen. This is the screenshot:

Thank you.
nhinzky 02 Oct, 2014
Here are the screenshots attached..

[attachment=0]2014-10-02_2055_001.png[/attachment]
[attachment=1]2014-10-02_2055.png[/attachment]
[attachment=2]2014-10-02_2053.png[/attachment]
GreyHead 02 Oct, 2014
Hi nhinzky,

The code you have in the Conditions box adds the user ID to the $form->data array but doesn't set a WHERE condition for the query, Please try:
<?php
$user = JFactory::getUser();
return ( array( 'user_id' => $user->id) );
?>
assuming that the User ID column in the table is named 'user_id'.

Bob
nhinzky 03 Oct, 2014
Hello Bob,

I tried your code where I replaced with the snippet you posted but it still won't populate the form. I have attached here the On Submit DB Save settings: [attachment=0]save-shot.png[/attachment]

Thanks.
GreyHead 03 Oct, 2014
Hi nhinzky,

I'm confused :-(

Is the problem with loading data from the database or saving it to the database?

Bob
nhinzky 03 Oct, 2014
Hello Bob,

As I check earlier, no data has been save to table after submission so my problem is the saving data to database, where I tried to use other form to test and it saves data but still won't load it to form. As I check the table fields the user_id is the user name in users table and in the table created in chronoforms is integer.

Thanks.
nhinzky 03 Oct, 2014
Can you please give me some tips on how to make it work, the saving and loading the data to form based from the user logged in?

Thank you very much.
Max_admin 05 Oct, 2014
Please post a screenshot for your "designer" section to check your fields names!

Also please add a "debugger" action after the "db read" and post the debug results shown on the form page!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
nhinzky 07 Oct, 2014
Hello Max,

Thank you for your help. Here are the screenshot attached.
[attachment=0]Administration 2014-10-07 14-12-26.png[/attachment]
[attachment=1]debugger-shot.png[/attachment]

Thanks.
Max_admin 07 Oct, 2014
Good, now we need 2 more screenshots, one for the setup, and another for the "db read" settings!🙂
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Max_admin 07 Oct, 2014
Also please note that you should not load the "password" field to the form, because its encrypted, and if you try to save this then some problems may occur!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
nhinzky 07 Oct, 2014
Hello,

Here are the screenshots attached.

[attachment=0]setup-shot.png[/attachment]
[attachment=1]dbread1.png[/attachment]
[attachment=2]dbread2.png[/attachment]

Thanks.
Max_admin 08 Oct, 2014
Ok, do you have any db records for this user id ? maybe there are not any to find ?
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.