Multiple Select Box will not save records

momentis 09 Oct, 2012
I am trying to use a multiple select drop box to populate a database field named "staff_buildings". The selection is set up as follows:
Village=Village
East=East
South=South
North=North
Middle=Middle
High=High

The field "staff_buildings" is set as VARCHAR(255). When I submit the form, nothing is saved in the database, while other fields on the form are. Any idea why?

What I would REALLY like to achieve is for the select box (or whatever field you think I should use) to save the record to the field "staff_buildings" like "Village,North,High" or "East,South". So, each selection should be separated by a comma. Is there any way to achieve this, if not by the multiple select box?

Thanks!!!!!
Rick
GreyHead 09 Oct, 2012
Hi Rick,

Please drag a Handle Arrays action into the OnSubmit event and move it up before the DB Save action.

Bob
momentis 09 Oct, 2012
Thanks! For some reason it will just not save the field. I added the Handle Arrays action just above the DB Save action, and I made no changes to the Handle Arrays action (left the defaults). When I submit the form on the front-end, changes to the other fields are saved. However, this particular field is not saved. I am loading the records under a Model ID, if that makes a difference.

This error is being thrown on the front-end when trying to save the record:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/avondevo/public_html/administrator/components/com_chronoforms/form_actions/db_save/db_save.php on line 112

momentis 09 Oct, 2012
I tried adding the field to the whitelist for the Handle Arrays. I tried just the field name (staff_building_test) as well as the field with model ID (StaffLoad[staff_building_test]).

No errors being thrown, but the field is not being saved.
momentis 09 Oct, 2012
Okay! I got it to save. I had to use "StaffLoad.staff_building_test" in the whitelist for the Handle Arrays action.

Now, how can I get the multiple select box to show the the selections highlighted when someone goes to edit the record? So, for example, I save a record with "middle,high", and it saves to the database that way. When I open up that record again, Middle and High should be highlighted in the multiple select box, which I can change if needed.
GreyHead 09 Oct, 2012
Hi Rick,

I think you need an entry in the Array Field Sets box on the DB Record Loader Advanced tab. I think that just takes the column names.

Bob
momentis 09 Oct, 2012
Bob,

That did it!! I just needed to add the field name and a comma in the Array Separators field and it worked like a charm.

Thank you SO much!!!

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