New Field not saving to DB

How to fix new form fields not saving to the database in ChronoForms.

Overview

The issue occurs because ChronoForms caches the database table structure, and manually adding columns via phpMyAdmin does not automatically update this cache.
Manually delete the specific database cache file from your server, or toggle the 'Save to database' setting for the new field off and on again within the ChronoForms editor.

Answered
ChronoForms v6
om omidhz 29 Nov, 2018
I have a form that saves or updates all the data to a database and it is working as it should.
I decided to add two more fields to the form called "wst" and "wst_unit", and I coded it just like other fields. Then I added two columns to the database via phpMyAdmin with the same names and format.
However, my form is NOT SAVING those two new fields to the database, even though the debugger shows it is saving it correctly. When I look at my debugger information, I don't see it listed where it suppose to save to the database.
I'm not sure what am I doing wrong.

See below:
Array
(
[chronoform] => demographics
[event] => submit
[activity] => 1.3
[ethnicity] => caucasian
[wt] => 222.00
[wt_unit] => 1
[ht] => 77.00
[ht_unit] => 1
[wst] => 36
[wst_unit] => 1
[button] =>
[cadc1bee9ebcbe83759a5448896141ea] => db907de6a339a1fb0a54fa254a7be221
[joomla_user_state] => logged_in
[format] => html
[Itemid] => 177
[option] => com_chronoforms6
[view] => form
)
Array
(
[validate_fields3] => Array
(
[log] => Automatic validation enabled.
[var] => 1
)

[save_data10] => Array
(
[data] => Array
(
[chronoform] => demographics
[event] => submit
[activity] => 1.3
[ethnicity] => caucasian
[wt] => 222.00
[wt_unit] => 1
[ht] => 77.00
[ht_unit] => 1
[wst] => 36
[wst_unit] => 1
[button] =>
[cadc1bee9ebcbe83759a5448896141ea] => db907de6a339a1fb0a54fa254a7be221
[joomla_user_state] => logged_in
[format] => html
[Itemid] => 177
[option] => com_chronoforms6
[view] => form
[modified] => 2018-11-29 22:24:35
)

[_success] => Data saved successfully
[log] => Array
(
[0] => UPDATE `response` AS `Data10` SET `activity` = '1.3', `ethnicity` = 'caucasian', `wt` = '222.00', `wt_unit` = '1', `ht` = '77.00', `ht_unit` = '1', `modified` = '2018-11-29 22:24:35' WHERE `user_ID` = '846';
)

[var] => Array
(
[activity] => 1.3
[ethnicity] => caucasian
[wt] => 222.00
[wt_unit] => 1
[ht] => 77.00
[ht_unit] => 1
[modified] => 2018-11-29 22:24:35
)

)

)
om omidhz 30 Nov, 2018
I already tried that twice. Still same result
om omidhz 30 Nov, 2018
I was able to fix this, but I have no idea how it got fixed..!.
Here is what I did.
I created a new dummy form to retrieve and save just the wst field into the same data. The new form gave me MySql error #1064.!
Then I deleted the two columns that I previously made in phpMyAdmin from my database via phpMyAdmin.
Then I went to Chronoforms 6 and modified the database by adding the columns there. That fixed everything.

I've had this problem before that when I created a column via phpMyAdmin I was getting error messages, but when I added the columns via Chronoforms database tool, it worked fine. Is there something I'm doing wrong or is this related to how the form is linked to the database??!!
he healyhatman 30 Nov, 2018
Answer
I think the cache is not actually deleted when you tell it to delete the cache. Or something I don't know it shits me
om omidhz 30 Nov, 2018
You may be right. Every time I click on Clear Cache, I get the message that 0 cache was deleted.!
Where does the cache get saved? Maybe I can see if it actually deleting anything.. 
om omidhz 30 Nov, 2018
I found this file:
root: cache/myDatabaseName.db_tables_info.cache.php
It contains the cache related to my form database. I did delete the data manually and saved the file and my forms continued to work fine and after I processed the form, it recreated the cache.
When I clicked on Clear Cache in the Chronoform application, the cache information remained intact. I guess this could be the issue.
om omidhz 30 Nov, 2018
2 Likes
I was able to reproduce the problem.
After I deleted the cache data manually, my form saved the new field to the database. This is clearly a bug in chornoform 6.
sk skittle 15 Jan, 2019
I experienced the same issue and agree that this a bug in CFv6. First, I tried refreshing the cache using the option in CF without success. Then, I tried deleting the cache file as suggested in this thread but this did not solve the problem for me either.

I was able to resolve this by switching the Save to database toggle (for the field not saving to the DB) to off, then saving the Chronoform. Next I opened the Chronoform again and switched the Save to database toggle back on and saved the Chronoform. This worked. While the cache may be a part of the problem here, it seems like the Save field to database option is not being save or updated as expected.

John
jp jpbhcom 30 Apr, 2019
This is still an issue, I made a change to a table, and the delete cache function didn't clear the cache, I attempted to flush the cache via Joomla however this didn't find the db cache file, ultimately I had to manually delete the cache file.
Max_admin Max_admin 30 Apr, 2019
Do you have the latest update ? this should be already fixed!

Best regards
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.