Forums

Load comprofiler data and save to other table

dorine@dpwebsites.nl 05 Nov, 2013
Hi there,

I am working on upgrading a Joomla website to 2.5 and i am struggling with records loading in my forms.
On the old website i have about 20 forms all loading data from the comprofiler table and saving the data in a custom table and everything is working fine.

I have been trying to create these forms in Chronoforms 4, i read all topcis about this subject, the tutorials and the faq but i cannot even get the form to load the data. What do i have to do to load the data in the forms using the curly brackets?
Nothting worked so far. (n.b. the tutorial shows different options than the current version; Load fields does not exist )

When i enable the debugger i get this:
Array
(
    [option] => com_content
    [Itemid] => 52
    [catid] => 38
    [id] => 131
    [view] => article
    [user_id] => 86
)

Validation Errors:

Array
(
)


At this point i am about to write all the forms in php because this would take less time than re-creating 20+ forms in Chronforms 4......
Max_admin 09 Nov, 2013
I'm not sure why do you have 20 forms, are they completely different?

Loading CB data into form:
http://www.chronoengine.com/forums/index.php?option=com_chronoforums&cont=posts&f=26&t=92316

Not user how you are saving the data but did you try a "db save" action ? create a simple form to testing first!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dorine@dpwebsites.nl 09 Nov, 2013
Hi Max,

I did not get to the saving part yet, i am stil trying to load the comprofiler data in the form.I read the topic you mention but no data is loaded into the form.

As you can see the user_id is loaded but the form is empty.
The tutorial talks about a token but i do not understand how to use this. I understand the concept of the token but don't know how to use it in Chronoforms.
I use the Chronoforms plugin to load the forms in an article.

There are so many forms because it is the website of a neighborhood association where members can register to courses and workshops and i built a custom administration system for them.
On this website are four slightly different registration forms and copies of them for the administration part. Plus a couple of forms to select data for printing letters to participants.
They are all forms i could write in php but with the old Chronoforms version i didn't need to. In the current version i haven't got a clue how to make it work.

In the form i am trying to get to work the registered user data is loaded into the fields and with some custom code (selecting titles of articles in a specified category) they can select the course or workshop they want to register to.
This data is saved into a custom table.

If i understand it correctly i need two forms; one to load the data from cb and another to save the data to another table because the formfield names need to match the table field names?

Regards, Dorine
Max_admin 14 Nov, 2013
Hi Dorine,

Please create a new form, in the on load event, add a "custom code" action and enter this code:


$user = JFactory::getUser();
$form->data['user_id'] = $user['id'];


Now add a "DB record loader" and add "user_id" in the request param, and enter the cb table user id field in the "db field", and select the db table from the list.

Now add a "debugger" action, then save the form and view it while being logged in, your data should be now loaded.

If your form fields names match the cb table fields names then the fields should be now loaded with data for the logged in user.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
dorine@dpwebsites.nl 14 Nov, 2013
Hi Max,

That is exactly what i did but the records are not loaded.
Should i use curly brackets or not?
Max_admin 15 Nov, 2013
Before using curly brackets you must make sure the data is loaded using the debugger, what do you get in the debugger ? the debugger will also show the SQL query used to load the data, make sure that everything is correct!

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.