Buy Now
Sign in

DB Read of basic joomla jsn_user info cfv5 versus cfv6

So I had CFV5 mastered for what I need it for, then comes along CFv6.
For CFV5, I use the following to read my user data from Easy Profile. I use Easy Profile to create all custom fields I want, and my chronoforms reads all data (text fields, radioboxes, dates, etc...)
(The only thing I want to do here is have CF6 read the user_id, username, email, firstname, and lastname. If I can get these items to read into a CF6 form, all my extra fields should be a piece of cake.)
My CF5 worked perfectly to read jsn_user (Easy Profile) data table
CF5 Custom Code1 [Note this is from the documentation at Easy Profile which is required to access their data]
CF5 Custom Code 2
​$user = \JFactory::getUser();​
​$user=JsnHelper::getUser(); ​
​$form->data['user_id'] = $user->id;​
​$form->data['lastname'] = $user->lastname;​
CF5 DB Read
table name "jsn_users" [this is the Easy Profile user table]
multiread is "no"
enable model id is "no"
Model id is "blank"
Conditions Box
​$user = JFactory::getUser();​
​return array("user_id" => $user->get("id"));​
CF5 Custom Code 3
​ $user = \JFactory::getUser();​
​ $user=JsnHelper::getUser();​
​$form->data['username'] = $user->username;​
​$form->data['user_id'] = $user->id;​
​$form->data['email'] = $user->email;​
​$form->data['firstname'] = $user->firstname;​
​$form->data['lastname'] = $user->lastname;
I also have a CF5 handle arrays on load to convert arrays back into the form (i.e., radio, checkbox, etc...)
All of the above will read the data into my CF5 form with all those fields present in the Designer and in the Data Table for this form.
Now, for CF6, I have tried a bunch of things to read my easy profile data.
First, if I put this
then I get this message when the form Loads: Parse error: syntax error, unexpected '<' in /home/*/public_html/libraries/cegcore2/admin/extensions/chronofc/functions/php/php_output.php(6) : eval()'d code on line 1
Second, I cannot add this
$user = \JFactory::getUser();$user=JsnHelper::getUser();
$form->data['user_id'] = $user->id;
$form->data['lastname'] = $user->lastname;
because $form->data in CF5 is now $this->data in CF6 (I tried chaning "form" to "this" without success)
Third, when I get to the DB Read (black label is "read_data13" and in CF6, it appears as though ModelID (which is named "data13") is mandatory.
I tried to add some Where Conditions{data:id} then I tried

​Data13.user_id:{data:id} then I tried

all with no luck.
I also tried to add some Fields to Retrieve
with no luck and the CF6 form doesnt load.
Hopefully CF6 can DB Read the jsn_users table like CF5.
Then I will turn my attention to DB save back to the jsn_users table which I had a special php code to accomplish on a field by field basis for any CF5 form.
ok. making progress.
i am now able to read from easy profile and save to a newly created chronoforms table.
so this post is really for anybody (like me) that was having trouble with cf6, particularly when compared to cf5.
first, some highlights of cf6 (once you get it working).
1. It saves ten times faster. You save a ton of time when you make changes to fields in the designer. You can make changes and go to other fields immediately. There is no delay. The forms open 10 times faster from the cfv6 component too.
2. The Model ID (which I could never get to work in CF5 with non cf tables, e.g. jsn_users) now works with apparent ease. The example attached actually reads from the easy profile jsn_users table and the standard joomla users table. Easy Profile (jsn_users) has always stated that it is an "extension" of the core joomla fields. For some strange reason, I could not "read" the "email" and "username" fields from the jsn_users profile (I checked the table using vj database tool, but these two fields were not there. But username and email were still showing up on the component for Easy Profile. And I could see username and email in the joomla users manager. So I checked the normal joomla users table and username and email are there.).
Using one model id, the attached formed "reads" jsn_users for the user_id, id, title, firstname, lastname, suffix, and test_field (make sure all of these are fields in Easy Profile and that they have data in them).
Using a second model id, I also tried and succeeded at ALSO reading from the joomla users table just the username and email.
note the slight differences in the model id numbers and model names, which are also in the Designer for each text field. For example, {var:read_data17.Data_Test.title} is in the text box for the field title. For username and email that are being read from the users table with a different model id, this is how the value looks {} and {var:read_data24.Data_Test2.username}
3. Here is the confusing part that is not confusing any more. Basically you have to create separate db read in the setup area with a different 'black label' e.g. read_data17 for jsn_users table and read_data24 for joomla users table, and a different model id name Data_Test for jsn_users table and Data_Test2 for joomla users table.
4. The biggest problem I found was the demos have no associated tables and examples of reading and saving. So I started with the demo-basic-contact and called it demo-basic-contact-read-save.
5. I changed the demo "title" field from a selection (mr. or mrs.) to just a text field.
6. Make sure the easy profile fields are identical to the fields in the form, and that they have entries for the user. I tested under a test user, not super admin.
7. The purpose of the form was to read the easy profile data as 'readonly' disabled text (i added css to grey out the disabled fields), that is only changed by the user in easy profile and not in this chronoform. That way you can "pull in" your "user data" and create a chronoform that is designed to accomplish something else.
8. The one field that allows input is the message text area field. This is done to see that the db save for the text area to the cf6 form changes on each submission. Have a look at the save settings in each text field, and in the db save. Trial and error got this to work. If you change anything it probably won't save.
9. This form does not save anything to the jsn_users datatable. This is my next step-project. Through agony I got this to work using a php code to save from cfv5 to easy profile jsn_users on a field by field basis. Why is this important? Simple. I typically have all of my chronoforms fields and data (not just the basic user data) also saved to the easy profile and to the chronoform itself (which creates a signature, pdf, and email, which I have not yet tackled for cf6).
10. I deleted the verification and email in the Setup area from the revised demo test form. it made it easier to test the db read and db save. These will be added later with signature, pdf, etc....
11. I am still thoroufhly confused that CF5 changed "id" to "aid" in CF6. So i added "aid" and 'id' to the test form just to see what is and what is not working.
The attached form is not perfect, but it's a solid start for anybody that wants to see how cf6 reads and saves.
here is the screenshot of the form on the front end with some data typed in the text area field
(152.99 KiB)
52 Downloads/Views
here is the data saved to the new cf data table. remember to create the datable and select it in the db read. per bob, the name is usually shortened from "chronoforms_rest_of_the_form_name" to just "cf_rest_of_the_form_name"
noticed the easy profile data and the typed entry in the text area area both saved to the cf6 datatable.
(162.47 KiB)
60 Downloads/Views
Annoyingly hard to find, but there it is.
Web developer at
I don't work for ChronoEngine but I do accept donations
Bingo. Success in reading from two DB Reads and saving to two DB Saves.
I have searched the forum posts for years looking for a complete backup form that accomplishes the two DB Saves in the same form. (you can find people that "got it to work", but without any tips to get it to work for you). A big shout out to Bob. Without him this would not have been possible. Lets deluge him with coffee.
A few pointers in getting this to work.
1. When I created the table for the CF6 form, I have to unselect the second "aid" in the table for the field "aid" in the designer. Compare this to CF5 when I always put "id" in the Designer, and had to uncheck the second "id" when create the table.
And when I uncheck the second "aid" and then try to change the table name from "chronoforms_basic_contact_form_read_save" to "cf_basic_contact_form_read_save", sometimes the create table button becomes disabled. Not sure why. So I hit "refresh", and then the second "aid" gets re-checked, so you have to uncheck it before hitting "create table"
2. This form might be able to be cleaned up a bit. I have "aid" and "id" each as a field in the Design. Fromy my days of CF5, nothing seemed to work well when "id" was not in the Design as a field. Now we have "aid", so I put that in the Design too without testing if it could be omitted. You might be able to remove one or both of these. To test delete one at a time, recreate your table (don't just delete "id" or the second "aid"from the table), and then remember to reselect the DB Save table name.
Why do I mention all this? Because the unset php code in the Setup between the two DB saves is "unset the id" not "unset the aid"
3. So now you can read from jsn_users (Easy Profile, for all fields except username and email) and normal joomal users table (for fields username and email), and then save to both the table for "cf_basic_contact_form_read_save" and jsn_users and BOTH will be updated.
With one exception, notice that I removed the readonly from the fields: title, firstname, lastname, suffix, test_field, message, email, and username. I did this to see what happens. So login as a test user. Then change all of these fields. When the form is processed, notice how the jsn_users updates and cf_basic_contact_form_read_save adds a new entry for each transaction. So even if you change the username and email, nothing is changed in jsn_users. I suspect this is because there is no third DB Save for the regular joomla users table. In other words, this chronoform table does not allow the form to change username and email. This can only be done in the Edit menu item for the Easy Profile component.
4. Lasly, there is one other noticeable difference compared to CF5. In CF5, my field names and field ids always had the same name. So Fieldname and Field ID for the "message" text area field would both have "message" as the typed entry. The only difference in CF5 for Fieldname and Fieldid of a field might be for adding "[]" at the end of a fieldname for an array (radio box, checkbox, etc...) to be saved.
But look at CF 6. Field name is "message" and Fieldid is "message_id". I tried to change the Fieldid to "message" without "_id" at the end. The form will not load. So CF 6 apparently requires the "_id" be added to the fieldname in the fieldid box.
5. Note also there are no array fields in the example form "cf_basic_contact_form_read_save". Its time to tackle that problem and see if I can get it to save to jsn_users, and recall from jsn_users.