I have the same issue. I created a registration CF5 Form, and saved it to both the table for the CF5 Form and to the separate jsn_users and jsn_field tables. I inputted the same fields in my registration CF5 Form by hand one by one in the Easy Profile admin area. So the fields are essentially identical in CF5 and Easy Profile. When you fill out the registration CF5 Form, it populates the Easy Profile exactly.
Then I wanted to call the data back up into an empty CF5 form by pulling the saved data up from the Easy Profile. Why? In order for admin to answer some new questions for users which users do not get to answer.
So I copied my CF5 Form and renamed it CF5 Form 2 and crated a new data table for CF5 Form 2.
After deleting the joomla registration in CF5 Form 2 (because the user is already registered, and the CF5 Form 2 is for admin to answer questions for existing users),
After leaving everything from the CF5 Form 1, in the CF5 Form 2 the Ordering in the ONLOAD area is to first add the custom code getuser
Then I inserted this in custom code.
Thus, I used the above code to get the core joomla id, email, name, middlename, lastname to pull back into my CF5 Form 2 via a database read. When via a menu item you pull up the CF5 Form 2 for the logged in user that created the data, the CF5 Form 1 data which is the same as the Easy Profile data are recalled backup and placed in the same field-boxes in CF5 Form 2 which they were created in CF5 Form 1. Everything is perfect.
The problem is getting the non-core joomla self-created CF5 Form 1 fields which were created via joomla registration and creating the same fileds in Easy Profile (created from processing my CF5 Form 1, which saved to Easy Profil databases jsn_users and jsn_fields) recalled back into CF5 Form 2 via the dbread.
I drug an ON LOAD custom code below the two DBreads
Now, if user is logged in and the menu item for CF5 Form 2 is recalled up by that user, it should call up the registration data stored in the Easy Profile for that user.
The problem is that it is just echoed out onto the page, and not into the field box it originally was created in CF5 Form 1 and should be showing up in the same spot on the CF5 Form 2.
This results in a date of birth field I created on CF5 Form 1 for the user (which I renamed in this forum as "my_field_dateofbirth") being echoed output in the top left corner of my form (in my case, it is at the top left of my first slider on the webpage when the form is called up).
So I can get the non-core joomla fields I created on CF5 Form 1, saved to Easy Profile jsn_users and jsn_fields, and recalled into CF5 Form 2.
But I cannot get the results in the actual correct CF5 Form 2 field box-area (the same box-area as on CF5 Form 1) for the fields that were self-created by my in CF5 Form 1.
The API from Easy Profile allows the info to be displayed on the CF5 Form 2, but the trick is going to be getting it into the actaul field area created on the CF5 Form. I tried putting the <?php $user=JsnHelper::getUser(); echo $user->getValue('my_field_dateofbirth'); ?> in the conditions box of the actual field in the designer, but the page won't load.
I will keep trying. At least my data from
Note, I also tried inputting the field names in the DBREAD, but the page will not load and the mysql error is asking for model id.
Then I wanted to call the data back up into an empty CF5 form by pulling the saved data up from the Easy Profile. Why? In order for admin to answer some new questions for users which users do not get to answer.
So I copied my CF5 Form and renamed it CF5 Form 2 and crated a new data table for CF5 Form 2.
After deleting the joomla registration in CF5 Form 2 (because the user is already registered, and the CF5 Form 2 is for admin to answer questions for existing users),
After leaving everything from the CF5 Form 1, in the CF5 Form 2 the Ordering in the ONLOAD area is to first add the custom code getuser
<?php
$user = \JFactory::getUser();
$form->data['user_id'] = $user->id;
?>
then drag over a DB Read (jsn_user with multiread on and model id off - I think Easy Profile doesnt allow model id to be on, it requires pulling back up from a CF 5 Table not the jsn_users and jsn_fields tables) then drag over another DB Read for (jsn_fields)
Then I inserted this in custom code.
<?php
$user =& JFactory::getUser();
$form->data['id'] = $user->id;
$form->data['email'] = $user->email;
$form->data['firstname'] = $user->name;
$form->data['middlename'] = $user->middlename;
$form->data['lastname'] = $user->lastname;
?>
Thus, I used the above code to get the core joomla id, email, name, middlename, lastname to pull back into my CF5 Form 2 via a database read. When via a menu item you pull up the CF5 Form 2 for the logged in user that created the data, the CF5 Form 1 data which is the same as the Easy Profile data are recalled backup and placed in the same field-boxes in CF5 Form 2 which they were created in CF5 Form 1. Everything is perfect.
The problem is getting the non-core joomla self-created CF5 Form 1 fields which were created via joomla registration and creating the same fileds in Easy Profile (created from processing my CF5 Form 1, which saved to Easy Profil databases jsn_users and jsn_fields) recalled back into CF5 Form 2 via the dbread.
I drug an ON LOAD custom code below the two DBreads
<?php
$user=JsnHelper::getUser(); echo $user->getValue('my_field_dateofbirth');
?>
the HTML Render form is last.
Now, if user is logged in and the menu item for CF5 Form 2 is recalled up by that user, it should call up the registration data stored in the Easy Profile for that user.
The problem is that it is just echoed out onto the page, and not into the field box it originally was created in CF5 Form 1 and should be showing up in the same spot on the CF5 Form 2.
This results in a date of birth field I created on CF5 Form 1 for the user (which I renamed in this forum as "my_field_dateofbirth") being echoed output in the top left corner of my form (in my case, it is at the top left of my first slider on the webpage when the form is called up).
So I can get the non-core joomla fields I created on CF5 Form 1, saved to Easy Profile jsn_users and jsn_fields, and recalled into CF5 Form 2.
But I cannot get the results in the actual correct CF5 Form 2 field box-area (the same box-area as on CF5 Form 1) for the fields that were self-created by my in CF5 Form 1.
The API from Easy Profile allows the info to be displayed on the CF5 Form 2, but the trick is going to be getting it into the actaul field area created on the CF5 Form. I tried putting the <?php $user=JsnHelper::getUser(); echo $user->getValue('my_field_dateofbirth'); ?> in the conditions box of the actual field in the designer, but the page won't load.
I will keep trying. At least my data from
Note, I also tried inputting the field names in the DBREAD, but the page will not load and the mysql error is asking for model id.
Hi bartonlaw,
The thread you posted in was old and I'm not sure that the question is the same so I've split this off.
I'm not too clear what you need to do here?
If you want to display data then you can do it using echo in Custom Code elements in your form.
If you want to set value in inputs then you can add the data to the $form->data array with names matching the corresponding input name e.g. $form->data['date_of_birth'] = $user->getValue('my_field_dateofbirth');
Bob
The thread you posted in was old and I'm not sure that the question is the same so I've split this off.
I'm not too clear what you need to do here?
If you want to display data then you can do it using echo in Custom Code elements in your form.
If you want to set value in inputs then you can add the data to the $form->data array with names matching the corresponding input name e.g. $form->data['date_of_birth'] = $user->getValue('my_field_dateofbirth');
Bob
This topic is locked and no more replies can be posted.