I designed a registration form using Chronoform 6 with the following elements:
[list]- First Name
- Last Name
- Email
- Confirm Email
- Password
- Confirm Passoword
- reCAPTCHA[/list]
I'm using a Custom PHP to combine First Name and Last name and to save it as name to the users table.
This form is working correctly and saving the new user information to default joomla "users" table.
I'm then using Login action to log in the user immediately after they sign up. And that is working fine.
What I am trying to do is to add a second Save to database action to my setup, to save "user id", First Name and Last Name to a separate table that I created called "users_details".
I added the Save to DB action to the Success condition of Log in action. So the data saves to the second table after the user is logged in.
I attached a screen shot of what I have in the Save to DB action.
Issues and what I need to happen instead:
1- User ID is being saved as 0 instead of current user ID. I thought having the user_id:{user:id} in the Override section takes care of this, but it doesn't.
2- The form is adding new columns to my table and saving email, email confirm, password and password confirm. Which I don't want. Those information are already being saved to default Joomla "users" table. I only need to save First Name and Last name.
I'm not sure how to do this.
I appreciate your help in advance.
[list]- First Name
- Last Name
- Confirm Email
- Password
- Confirm Passoword
- reCAPTCHA[/list]
I'm using a Custom PHP to combine First Name and Last name and to save it as name to the users table.
This form is working correctly and saving the new user information to default joomla "users" table.
I'm then using Login action to log in the user immediately after they sign up. And that is working fine.
What I am trying to do is to add a second Save to database action to my setup, to save "user id", First Name and Last Name to a separate table that I created called "users_details".
I added the Save to DB action to the Success condition of Log in action. So the data saves to the second table after the user is logged in.
I attached a screen shot of what I have in the Save to DB action.
Issues and what I need to happen instead:
1- User ID is being saved as 0 instead of current user ID. I thought having the user_id:{user:id} in the Override section takes care of this, but it doesn't.
2- The form is adding new columns to my table and saving email, email confirm, password and password confirm. Which I don't want. Those information are already being saved to default Joomla "users" table. I only need to save First Name and Last name.
I'm not sure how to do this.
I appreciate your help in advance.
Hello omidhz,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I save form data to a database table?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How do I save form data to a database table?
P.S: I'm just an automated service😉
Hi omidhz ,
For 2. just delete the extra columns from the table, when you create a table from a form you can un-check the items that you don't want added as columns using the Add/Remove checkbox.
For 1. I suspect that the new User ID may not be available using that syntax until the new user has logged in, Try adding a Debugger action to see if the new User ID is available in the form data.
Bob
For 2. just delete the extra columns from the table, when you create a table from a form you can un-check the items that you don't want added as columns using the Add/Remove checkbox.
For 1. I suspect that the new User ID may not be available using that syntax until the new user has logged in, Try adding a Debugger action to see if the new User ID is available in the form data.
Bob
Some unseal things happening that I can't explain why and not sure how to fix it.
Here are the scenarios:
1- In my form designer, I turned off "Save to Database" option for all fields (email, email confirm, password, password confirm, terms and condition check box, age check box) except for First Name and Last Name. In this situation, when I test the form, user information is being saved to default Joomla "users" table, but not to my second table and I get the following SQL error:
2- Then I enabled "Save to Database" for the email field only, in addition to First Name and Last Name. I still kept the Save to Database turned off for email confirm, password, password confirm, terms and condition check box, age check box. This time, the form submits correctly. But, even though I deleted the extra columns from my secondary table, the form automatically added extra columns for email, email confirm, password, password confirm, terms and condition check box, and age check box and then saved the data to the second table as well. Still user_id in second table is 0. Here is the debugger result for this scenario:
Attached is a screenshot of my Submit setup
Here are the scenarios:
1- In my form designer, I turned off "Save to Database" option for all fields (email, email confirm, password, password confirm, terms and condition check box, age check box) except for First Name and Last Name. In this situation, when I test the form, user information is being saved to default Joomla "users" table, but not to my second table and I get the following SQL error:
1054 - Unknown column 'email' in 'field list'
2- Then I enabled "Save to Database" for the email field only, in addition to First Name and Last Name. I still kept the Save to Database turned off for email confirm, password, password confirm, terms and condition check box, age check box. This time, the form submits correctly. But, even though I deleted the extra columns from my secondary table, the form automatically added extra columns for email, email confirm, password, password confirm, terms and condition check box, and age check box and then saved the data to the second table as well. Still user_id in second table is 0. Here is the debugger result for this scenario:
Array
(
[option] => com_chronoforms6
[chronoform] => user-registration
[event] => submit
[fname] => John
[lname] => Doe
[email] => jonny@gmail.com
[confirm_email] => jonny@gmail.com
[password] => 123456
[confirm_password] => 123456
[adult] => 1
[terms] => 1
[g-recaptcha-response] => 03AOPBWq8SGjNAMN31zTAAt3-UW9TJacSPJtjlTIL6Tgz49YDL4DN7OkhHQB4WJK690aDxCnBMlsTAt9RZrTw1hH26OjWmXLuxgQWOBcDHqEubxm3iujpzpk3njrGjWzoiEIGZVQoSiDfrViIUXhRTvbN2UxgznJNTaIpkbX459oSpzZkkBqgmVX2nprFjSZk4gyJemoMEYQoy9r7SjFRxNElvnkfjrkL9OHvmkiW0bozNcUeHQRabKM9QLu3MFjgnY5xaMU4S49fF8edcjWx8NlTlKE3SERZUjFvrPCpE06YeAdr-8kDLTgvjc52ixie6XGvg6LqS4xqbRRugTLlAysuy5beHWwViCkOrvfArMISUXgu9OSyiDQSdYxX-WzqTBRdC4z0R-_5SYe3wjB6-4U6CKvdjdfAPkocICQPGteGS8g8o4mJ3On0
[button61] =>
[Itemid] =>
[name] => John Doe
)
Array
(
[google_nocaptcha6] => Array
(
[_success] => The NoCaptcha verification was successfull.
[var] => 1
)
[joomla_user8] => Array
(
[_success] => User saved successfully under id 244
[var] => Array
(
[name] => John Doe
[username] => jonny@gmail.com
[email] => jonny@gmail.com
[password] => $2y$10$ebLia9FNwoPZUnjDxKzqCOcqgHz/rrTFfEvox2iCenHN8X.IESPTW
[block] => 0
[activation] =>
[registerDate] => 2017-06-12 21:33:54
[id] => 244
)
)
[joomla_login15] => Array
(
[_success] => User logged in successfully.
[var] => 1
)
[save_data23] => Array
(
[data] => Array
(
[option] => com_chronoforms6
[chronoform] => user-registration
[event] => submit
[fname] => John
[lname] => Doe
[email] => jonny@gmail.com
[confirm_email] => jonny@gmail.com
[password] => 123456
[confirm_password] => 123456
[adult] => 1
[terms] => 1
[g-recaptcha-response] => 03AOPBWq8SGjNAMN31zTAAt3-UW9TJacSPJtjlTIL6Tgz49YDL4DN7OkhHQB4WJK690aDxCnBMlsTAt9RZrTw1hH26OjWmXLuxgQWOBcDHqEubxm3iujpzpk3njrGjWzoiEIGZVQoSiDfrViIUXhRTvbN2UxgznJNTaIpkbX459oSpzZkkBqgmVX2nprFjSZk4gyJemoMEYQoy9r7SjFRxNElvnkfjrkL9OHvmkiW0bozNcUeHQRabKM9QLu3MFjgnY5xaMU4S49fF8edcjWx8NlTlKE3SERZUjFvrPCpE06YeAdr-8kDLTgvjc52ixie6XGvg6LqS4xqbRRugTLlAysuy5beHWwViCkOrvfArMISUXgu9OSyiDQSdYxX-WzqTBRdC4z0R-_5SYe3wjB6-4U6CKvdjdfAPkocICQPGteGS8g8o4mJ3On0
[button61] =>
[Itemid] =>
[name] => John Doe
[created] => 2017-06-12 21:33:55
[user_id] => 0
)
[_success] => Data saved successfully
[log] => Array
(
[0] => INSERT INTO `ip8gb_cf_user_details` (`fname`, `lname`, `email`, `confirm_email`, `password`, `confirm_password`, `adult`, `terms`, `created`, `user_id`) values ('John', 'Doe', 'jonny@gmail.com', 'jonny@gmail.com', '123456', '123456', '1', '1', '2017-06-12 21:33:55', '0');
)
[var] => Array
(
[fname] => John
[lname] => Doe
[email] => jonny@gmail.com
[confirm_email] => jonny@gmail.com
[password] => 123456
[confirm_password] => 123456
[adult] => 1
[terms] => 1
[created] => 2017-06-12 21:33:55
[user_id] => 0
[aid] => 2
)
)
)
Attached is a screenshot of my Submit setup
Hi Omid,
#1- looks like an update operation is being executed, please set the save data to "insert".
#2- please disable the "auto manage table fields" setting in order to avoid auto adding the form fields to the table.
Best regards,
Max
#1- looks like an update operation is being executed, please set the save data to "insert".
#2- please disable the "auto manage table fields" setting in order to avoid auto adding the form fields to the table.
Best regards,
Max
This topic is locked and no more replies can be posted.