Hi
Have googled and read these forum posts on how develop custom user fields. Cant figure how to use this functionality.
Have created a custom field called "company" - a text field in Users.
Then in a ChronConnectivity5 connection have added a new model called customFields. So this sits next to the Users model. Is it correct that this custom model will save its values in #_fields_values? And seems it will have a hasOne relation to the Users table. Then for the foreign key have used field_id which is the id for the Users table. Correct so far ?
Then in the Designer tab of Chronforms have added a text box with field name company. Then in the Setup tab the DB Save action sends the value to #_users. So how does the value get saved to #_fields_values ?
And back to the ChronoConnectivity component, in the Columns list, the company is "customFields.company:Company".
I had it all working fine with additional fields in the users table but not so much when splitting them out into custom fields.
Problem is that company values are not saved .
Thanks for any guidance here... .
Have googled and read these forum posts on how develop custom user fields. Cant figure how to use this functionality.
Have created a custom field called "company" - a text field in Users.
Then in a ChronConnectivity5 connection have added a new model called customFields. So this sits next to the Users model. Is it correct that this custom model will save its values in #_fields_values? And seems it will have a hasOne relation to the Users table. Then for the foreign key have used field_id which is the id for the Users table. Correct so far ?
Then in the Designer tab of Chronforms have added a text box with field name company. Then in the Setup tab the DB Save action sends the value to #_users. So how does the value get saved to #_fields_values ?
And back to the ChronoConnectivity component, in the Columns list, the company is "customFields.company:Company".
I had it all working fine with additional fields in the users table but not so much when splitting them out into custom fields.
Problem is that company values are not saved .
Thanks for any guidance here... .
Maybe my question is too broad and rambling. Will try be more focused
Joomla 3.9 -- ChronoForm V5
I have a form for user registration. It has the core Joomla User fields and also a custom field called "company". The custom field name appears in the #_fields table.
Two Questions
Joomla 3.9 -- ChronoForm V5
I have a form for user registration. It has the core Joomla User fields and also a custom field called "company". The custom field name appears in the #_fields table.
Two Questions
- If I get this thing working will the user values be stored in 2 tables, ie Users and #_fields.values ?
- What are the steps to make this happen? Presume need to configure the DB Save function in the form Setup tab differently. It currently saves to #_Users but cant see how to save it to both tables.
1. The user stuff is stored in Users, the custom values in #_fields_values.
2. You need TWO save actions, one for #_users and one for #_fields_values
field_id: The ID of the custom field (pretty obvious)
item_id: The user's id (get it from your first save data action after you do it, maybe, I don't know how v5 works)
value: Also obvious
2. You need TWO save actions, one for #_users and one for #_fields_values
field_id: The ID of the custom field (pretty obvious)
item_id: The user's id (get it from your first save data action after you do it, maybe, I don't know how v5 works)
value: Also obvious
Two save actions ... darn I should have figured that out. Will try get it working now, thanks for helping
Doing something wrong.
Renamed company field in Users table so cant save there. Created new DB Save, saving to the _fields.values table. Also gave it a unique Model ID so it wont clash with the Users DB Save. Must be close, will work on it in the morning.
Renamed company field in Users table so cant save there. Created new DB Save, saving to the _fields.values table. Also gave it a unique Model ID so it wont clash with the Users DB Save. Must be close, will work on it in the morning.
Still not working - values not saving to #_fields.values table.
In the DB Save have used the same parameters as in the main DB Save, except for referencing prefix_fields.values and giving the Model ID a unique name
Any ideas where to look ?
In the DB Save have used the same parameters as in the main DB Save, except for referencing prefix_fields.values and giving the Model ID a unique name
Any ideas where to look ?
Post copy of debug and screenshot of your save data action
Thanks Healyhatman.
The form saves to the Users table but the company value xxx does not save to the _fields_values table.
Errors
Debug Info
The form saves to the Users table but the company value xxx does not save to the _fields_values table.
Array
(
[chronoform] => memberRegistrationNew
[event] => submit
[name] => xxx
[username] => xxx
[email] => xxx@gmail.com
[password] => ciu123
[confirmpassword] => ciu123
[ciuStatus] =>
[title] =>
[occupation] =>
[describeoccupation] =>
[experience] =>
[explainexperience] =>
[company] => xxx
[city] =>
[Province] =>
[country] =>
[nameCountry] =>
[telephone] =>
[chrono_security_answer] =>
[button7] => Submit
[password2] => ciu123
[_PLUGINS_] => Array
(
[joomla_registration] => Array
(
[*isRoot] =>
[id] => 1044
[name] => xxx
[username] => xxx
[email] => xxx@gmail.com
[password] => $2y$10$KjDu3DNgbZy14FIwnNd.tORXZsLYcPisbqrbEoWxtndpZgDZ/iEMW
[password_clear] => ciu123
[block] => 1
[sendEmail] => 0
[registerDate] => 2019-01-03 15:54:48
[lastvisitDate] =>
[activation] => 62ff517eaa00e0c13183d9064838965a
[groups] => Array
(
[0] => 2
)
[lastResetTime] =>
[resetCount] =>
[requireReset] =>
[*_params] => Joomla\Registry\Registry Object
(
[data:protected] => stdClass Object
(
)
[initialized:protected] =>
[separator] => .
)
[*_authGroups] =>
[*_authLevels] => Array
(
[0] => 1
[1] => 1
[2] => 5
)
[*_authActions] =>
[*_errorMsg] =>
[*userHelper] => Joomla\CMS\User\UserWrapper Object
(
)
[*_errors] => Array
(
)
[aid] => 0
[chronoform] => memberRegistrationNew
[event] => submit
[confirmpassword] => ciu123
[ciuStatus] =>
[title] =>
[occupation] =>
[describeoccupation] =>
[experience] =>
[explainexperience] =>
[company] => xxx
[city] =>
[Province] =>
[country] =>
[nameCountry] =>
[telephone] =>
[chrono_security_answer] =>
[button7] => Submit
[password2] => ciu123
[usertype] => deprecated
)
)
=> 0
[ip_address] => 45.72.155.101
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[21] => Array
(
[Check Security Question] => Array
(
[0] => Passed the answer check!
)
)
[25] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
)
)
)
[19] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:ciu@ublizi.com
[2] => Subject:New Member Registered
[3] => From name:CIU Admin
[4] => From email:ciu@ublizi.com
[5] => CC:
[6] => BCC:
[7] => Reply name:0
[8] => Reply email:0
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<table>
<tr><td>Important</td><td></td></tr>
<tr><td>Name</td><td>xxx</td></tr>
<tr><td>User Name</td><td>xxx</td></tr>
<tr><td>Email</td><td>xxx@gmail.com</td></tr>
<tr><td>Password </td><td>ciu123</td></tr>
<tr><td>Confirm Password </td><td>ciu123</td></tr>
<tr><td>CIU Status</td><td></td></tr>
<tr><td>Title</td><td></td></tr>
<tr><td>Occupation</td><td></td></tr>
<tr><td>Describe Occupation</td><td></td></tr>
<tr><td>UW Experience</td><td></td></tr>
<tr><td>Please Explain </td><td></td></tr>
<tr><td>Company</td><td>xxx</td></tr>
<tr><td>City</td><td></td></tr>
<tr><td>Province / State</td><td></td></tr>
<tr><td>Country</td><td></td></tr>
<tr><td>Name Country</td><td></td></tr>
<tr><td>Telephone</td><td></td></tr>
<tr><td></td><td></td></tr>
</table><br /><br />IP: 45.72.155.101
)
)
[20] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:xxx@gmail.com
[2] => Subject:CIU Registration
[3] => From name:CIU Admin
[4] => From email:ublizi@gmail.com
[5] => CC:
[6] => BCC:
[7] => Reply name:0
[8] => Reply email:0
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<p>Thank you for registering with the CIU.</p>
<p>If you are a paid-up CIU member for the current calendar year, the administrator will approve this registration and will advise you of this. You can then login to the site with your new username / password.</p>
<p>If you are not a paid-up CIU member for the current calendar year, the CIU administrator will contact you. </p>
<p>If no communication within 24 hours please contact the CIU administrator at ublizi@gmail.com</p><br /><br />IP: 45.72.155.101
)
)
)
Do you have two data saves? Where's the screenshot of that?
Cant see the part where you're entering the values
Not sure there is another part in V5, just the table name sends it to the correct table? Have the same action for the Users table and it sends to the Users table. Not sure what u mean.
No. Where on your data save you're putting in the values to be saved to the db
Excellent question. Have no idea but u're right. Have a form with some values going to users table and other values to _fields_values. How does form know which table to send to? When I had all values going to users table it just worked - presume the Joomla Registration action (which references only the core reg fields ie name / user / pass) did the linkage and then all the additional field values got passed there too. I'll dig around some more.
Hi hangbill,
I suspect that the form does not know which table to send to - you may need to add a DB Save action for the second table.
Bob
I suspect that the form does not know which table to send to - you may need to add a DB Save action for the second table.
Bob
Thanks Bob
I have added a 2nd DB Save but how do I tell the form fields which ones go to the users table and which ones go to the _fields_values table
I have added a 2nd DB Save but how do I tell the form fields which ones go to the users table and which ones go to the _fields_values table
Hi Hangbill,
You create a sub-set of the form data and identify that in the Data provider box of the DB Save action.
Bob
You create a sub-set of the form data and identify that in the Data provider box of the DB Save action.
Bob
V5
Thanks for helping Bob.
How do I create a sub-set of the form data ?
I dont see a Data box in DB Save action - is that the table name or a model?
Thanks for helping Bob.
How do I create a sub-set of the form data ?
I dont see a Data box in DB Save action - is that the table name or a model?
Hi hangbill,
In CFv5 you can use the Model ID to distinguish the set of data to save. It would need to be a sub-array of the form data e.g. $form->data['table_2']['name'}, $form->data['table_2']['email'}, etc.
If the column names are unique then you may not need this.
Bob
In CFv5 you can use the Model ID to distinguish the set of data to save. It would need to be a sub-array of the form data e.g. $form->data['table_2']['name'}, $form->data['table_2']['email'}, etc.
If the column names are unique then you may not need this.
Bob
I understand, thanks Bob.
But the question always comes down to nasty practical things like which buttons to press.
So re the model
But the question always comes down to nasty practical things like which buttons to press.
So re the model
- in the DB Save edit dialogue I set "Save under Model ID" = Yes
- Give the Model ID a unique name
- But where do I code [em]$form->data['table_2']['name'}[/em] etc. Is this done in the Connectivity app?
Hi hangbill,
No - you don't need CC, you can use a Custom PHP action if you need to rename or re-format some of the form data elements.
Bob
No - you don't need CC, you can use a Custom PHP action if you need to rename or re-format some of the form data elements.
Bob
OK I'll try it, thanks Bob.
So then does the Action Label (in the custom code dialogue) become the Model name? Because in previous post you said ""In CFv5 you can use the Model ID to distinguish the set of data to save. It would need to be a sub-array ... ."
So then does the Action Label (in the custom code dialogue) become the Model name? Because in previous post you said ""In CFv5 you can use the Model ID to distinguish the set of data to save. It would need to be a sub-array ... ."
I found one of your videos on saving db's. So here's what I have done, not working yet.
Created custom code. Action label = customUserData. Code is $form->data['jospc_fields_values']['company'};
Placed this just above the DB Save action so that it's available when called.
Pics show story.
Am I on the right track Bob?
[img=11354]custom_code.png[/img]


Created custom code. Action label = customUserData. Code is $form->data['jospc_fields_values']['company'};
Placed this just above the DB Save action so that it's available when called.
Pics show story.
Am I on the right track Bob?
[img=11354]custom_code.png[/img]


This topic is locked and no more replies can be posted.


