Buy Now
Sign in

CC6 (v6.06) DBsave Not updating all fields

CSDweb , December 13 2017
Answered
C
CSDweb
Hi, I'm trying to get a CC6 set,up to be used for updating a database. When it loads all of the db fields are loaded into a table using a 'read data' option. The 'data settings' type option is set to 'All Matching Records'. When one of the rows of the table is selected via an 'edit link', an edit form is displayed with all of the fields shown and all of the fields can be edited. When the 'save/submit' button is selected, I get a 'saved successfully' message, but only two of the fields actually get updated in the database. Using the 'debug' option, I can see that the field values have been changed, but not saved to the db. Below are the relative debug messages show the data being loaded and the after the save option is selected. How do I get the form to save all fields?

DEBUG (After Read Data)
Array
(
[read_club] => Array
(
[log] => Array
(
[0] => SELECT COUNT(`Club`.`id`) AS `Club.count` FROM `areaclubs` AS `Club` WHERE `Club`.`id` = '12b';
[1] => SELECT `Club`.`dayweek` AS `Club.dayweek`, `Club`.`clubicon` AS `Club.clubicon`, `Club`.`id` AS `Club.id`, `Club`.`area` AS `Club.area`, `Club`.`category` AS `Club.category`, `Club`.`clubname` AS `Club.clubname`, `Club`.`dancelevel` AS `Club.dancelevel`, `Club`.`clubdesc` AS `Club.clubdesc`, `Club`.`weblink` AS `Club.weblink`, `Club`.`clubschedule` AS `Club.clubschedule`, `Club`.`schedulestarts` AS `Club.schedulestarts`, `Club`.`scheduleends` AS `Club.scheduleends`, `Club`.`clubcontactinfo` AS `Club.clubcontactinfo`, `Club`.`clubcontactemail` AS `Club.clubcontactemail`, `Club`.`comments` AS `Club.comments`, `Club`.`venuename` AS `Club.venuename`, `Club`.`venueaddress1` AS `Club.venueaddress1`, `Club`.`venueaddress2` AS `Club.venueaddress2`, `Club`.`venuecity` AS `Club.venuecity`, `Club`.`venuestate` AS `Club.venuestate`, `Club`.`venuezipcode` AS `Club.venuezipcode`, `Club`.`cssdamember` AS `Club.cssdamember`, `Club`.`latlng` AS `Club.latlng`, `Club`.`state` AS `Club.state` FROM `areaclubs` AS `Club` WHERE `Club`.`id` = '12b' LIMIT 30;
)

[var] => Array
(
[Club] => Array
(
[dayweek] => 1 Sun
[clubicon] => gunnisonGorgeDancers.jpg
[id] => 12b
[area] => CWASRDC
[category] => Square
[clubname] => Gunnison Gorge Dancers
[dancelevel] => MS +
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
[weblink] => http://www.cosquaredancing.com/ggd/
[clubschedule] => gunnisonGorgeDancers2012.pdf
[schedulestarts] => 1/8/2012 0:00
[scheduleends] => 12/23/2012 23:59
[clubcontactinfo] => Ervin Wyatt 970-596-4252
[clubcontactemail] => sqdancers@cosquaredancing.com
[comments] =>
[venuename] => Cunnison Community Center
[venueaddress1] => 200 Spencer
[venueaddress2] =>
[venuecity] => Gunnison
[venuestate] => CO
[venuezipcode] => 81230
[cssdamember] => Yes
[latlng] => _blank
[state] => 0
)

)

)

[check_club_exists] => Array
(
[finished] => 1
[var] =>
)

)

DEBUG (After SAVE/SUBMIT selected)


Array
(
[option] => com_chronoconnectivity6
[cont] => manager
[conn] => test-club-listing
[event] => save
[club_id] => 12b
[Club] => Array
(
[id] => 12b
[clubname] => Gunnison Gorge Dancers
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
)

[clubicon] =>
[area] => 0
[member] => y
[contactinfo] =>
[weblink] =>
[calendarlink] =>
[venue] => test
[radios22] => 0
[state] => 0
[save] =>
)

Array
(
[save_club] => Array
(
[data] => Array
(
[id] => 12b
[clubname] => Gunnison Gorge Dancers
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
)

[_success] => Data saved successfully
[log] => Array
(
[0] => UPDATE `areaclubs` AS `Club` SET `clubname` = 'Gunnison Gorge Dancers', `clubdesc` = 'We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.' WHERE `id` = '12b';
)

[var] => Array
(
[clubname] => Gunnison Gorge Dancers
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
)

)

[check_save_result] => Array
(
[finished] => 1
[var] =>
)

)


admin
Hi CSDweb,

It depends on the data porvider you have used in the "Save data", it looks like you have used {data:Club} which means that only fields under "Club" will be saved, and you have only 2 fields!

You need to update the other fields names.

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
C
CSDweb
Thank you for responding. I'm confused. When I look at the debug info after the edit form is loaded it shows that the data:Club array includes all on elements (see details below). It's what is used to pre-fill the form for editing. So, how do I get the data:Club provider to include all of the fields that are displayed, and available for editing via the edit form? The data appears to be coming into the form via the data:Club array, but isn't being saved (only three fields get saved/updated).

Debug after edit form is loaded/prefilled
[Club] => Array
(
[dayweek] => 1 Sun
[clubicon] => test icon
[id] => 12b
[area] => 0
[category] => Square
[clubname] => Gunnison Gorge Dancers
[dancelevel] => MS +
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
[weblink] =>
[clubschedule] => gunnisonGorgeDancers2012.pdf
[schedulestarts] => 1/8/2012 0:00
[scheduleends] => 12/23/2012 23:59
[clubcontactinfo] => Ervin Wyatt 970-596-4252
[clubcontactemail] => sqdancers@cosquaredancing.com
[comments] =>
[venuename] => test-5
[venueaddress1] => 200 Spencer
[venueaddress2] =>
[venuecity] => Gunnison
[venuestate] => CO
[venuezipcode] => 81230
[cssdamember] => Yes
[latlng] => _blank
[state] => 1
)
Debug After selecting save
[Club] => Array
(
[id] => 12b
[clubname] => Gunnison Gorge Dancers
[clubdesc] => We are a banner stealing Mainstream/Plus Club. We dance on the 1st & 3rd Sunday. Our club caller is Ervin Wyatt.
)
admin
Hi CSDweb,

The 2nd debug is based on the fields names on the form, what are the fields names ? do they include the "Club" model name ?

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
C
CSDweb
Yes, the form includes (matches) all of the DB field names that I want to be saved.
admin
Yes, but all the fields names of the "save" form have "Club" ? they should be all in this format: Club[field_name]
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
C
CSDweb
Thank you. Using Club[field_name] fixes my save/db update. Now I just need to figure out how to get a checkbox to show checked/uncecked based upon the state recorded in the db.
admin
Hi CSDweb,

If the checkbox name and value matches the table field name and value then it will be checked in case you have use the "Form data provider" under the "Display section" action to populate all the form fields.

But if you want to control the checkbox only then please use the "Checked status provider" under the "Checkbox settings > Advanced"

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
C
CSDweb
I have the checkbox name set to match the field name ( Club[state] ) but it's not working. The only option available under the Advanced Setting are: Extra attributes, Validation rules and Container class.
C
CSDweb
It's not ideal, but I've found that I can use a Y/N Checkboxes field instead of a single Checkbox field inside of a CC6 Form and have it checked (Yes or No) based upon a DB read, and have it save a checked value. It somewhat works for what I need, but when both Yes and No can be checked at the same which is very undesirable. What can I do to enable having only a single selection possible. Ideally, when Yes is selected No should be unchecked and vice a versa. I also have another field with an option to selected the day of the week and would like to limit the selection to a single day, but currently multiple days can be selected.
GreyHead
Hi CSDweb,

You should be able to use Radio buttons if you want to show both Yes and No values - or you can use a single Checkbox with the Ghost option enabled if you want it to submit a value when un-checked.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
C
CSDweb
It doesn't work in CC v6.06. With a single Checkbox, the selection isn't saved, even with the Ghost option enabled. With Checkboxs (Y/N), both Y and N can be selected at the same time.
admin
Hi CSDweb,

What id you use a "Radio" field ? also the checkbox field value should be saved if the field name matches the database table field name, is this the case ?

Best regards
Max
If your main question got answered then please mark the answer using the button!​
​Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!