I'm not sure why a new record is not being made with my db save action. Here is the debug info:
Array
(
[option] => com_chronoforms5
[chronoform] => add_equip_form
[event] => submit
[equipment] => Array
(
[state_tag] => Z12345
[type] => Desktop PC
[brand] => Lenovo
[model] => X9876
[serial_no] => 123456
[memory] => 4 GB
[prod_key] =>
[purch_date] => 2015-12-01
[warr_date] => 2015-12-31
[status] => 4
[building] => 10
[room] => NG-102
[date_moved] => 2015-12-02
[comments] => No comments
[date_entered] => 2015-12-09
[staff] =>
)
[button23] => Submit
[result] => 1
)
I am using a db save configured as shown:
[attachment=0]db_save.jpg[/attachment]
The state_tag is the PK for the table and is unique so it should be adding new records to the table but I'm afraid it is not. It's probably something simple I'm over-looking.
Thanks for your help.
Chris
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?
How to load record data from a database table into your form
My form data isn't saving to the database correctly
My CFv5 form data isn't saving to the database correctly
How can I edit my database table and debug queries?
How can I select 'types' in a database table?
How can I edit a record from a database table?
How can I add a new column to a database table or change a column type?
P.S: I'm just an automated service😉
That all looks correct - please post the rest of the DeBugger output including the generated MySQL query.
Bob
The table has a numeric primary key (it will if you used the ChronoForms 'Create table' icon). It must be an integer and not a string.
I don't know if CFv5 has changed so that I don't need an integer for the primary key. I suppose I can add a column to the table for an auto incremented integer as the PK and create a unique index for the state_tag, but I would prefer to keep the state_tag as the PK since it is unique. What are your thoughts?Array
(
[option] => com_chronoforms5
[chronoform] => add_equip_form
[event] => submit
[equipment] => Array
(
[state_tag] => Z12345
[type] => Desktop PC
[brand] => Lenovo
[model] => X12345
[serial_no] => Y7890
[memory] => 4 GB
[prod_key] =>
[purch_date] => 2015-12-01
[warr_date] => 2015-12-31
[status] => 4
[building] => 11
[room] => NG-102
[date_moved] => 2015-12-03
[comments] => No comments
[date_entered] => 2015-12-10
[staff] => Chris Obenberger
)
[button23] => Submit
[result] => 1
)
Array
(
[34] => Array
(
[DB Save] => Array
(
[Queries] => Array
(
[0] => UPDATE `its_equipment` AS `equipment` SET `type` = 'Desktop PC', `brand` = 'Lenovo', `model` = 'X12345', `serial_no` = 'Y7890', `memory` = '4 GB', `prod_key` = '', `purch_date` = '2015-12-01', `warr_date` = '2015-12-31', `status` = '4', `building` = '11', `room` = 'NG-102', `date_moved` = '2015-12-03', `comments` = 'No comments', `date_entered` = '2015-12-10', `staff` = 'Chris Obenberger' WHERE `state_tag` = 'Z12345';
)
)
)
)
I solved the problem by setting the "Force save" option in the DB Save action to "Yes".
Force save will work OK as long as you don't have a duplicate state_tag.
I'd probably use an auto-incrementing cf_id column as the primary key - I think that you can still set the state_key column to be unique. The integer requirement is an over-lap from the way the Joomla! database classes work.
Bob
