Error 1054 Unknown column 'Array' in 'field list' when UPDATING Field Multi Select

rmpaolillo 27 Nov, 2017
Hi Max and Bob,

I have been using CF6 for a while now and I found this strange behaviour.
When I use a Field Select (Multi Select) together with a Save Data Action (INSERT) the data in the relevant DB Field are stored this way

["on foot","bike","motorbike","car"]

and so far so good.

In a CRUD scenario if I want to UPDATE/PATCH the same data loaded from database I receive this error
Error 1054 Unknown column 'Array' in 'field list


Is this a bug or I need to convert someway/somehow the data before saving.
If so this does not make much sense to me. Why in an INSERT scenario I can do it straightforward while in an UPDATE scenario I have to manipulate the data?

Regards.

Marco
Max_admin 29 Nov, 2017
Hi Marco,

Please post a screenshot of your "Save data" settings.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 04 Dec, 2017
Hi Marco,

Please clear the "Special fields" box, this box is for fields which needs special processing, and you can not pass a shortcode inside it.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rmpaolillo 05 Dec, 2017
Hi Max,

thank you for your reply but that did not help to solve the issue.

Please find herewith enclose the insert and update form together with the SQL dump (two lines).

Very simple scenario 2 forms two lines in the DB.

If you have time, please have a quick look.

I am stuck with it.

Marco
Max_admin 06 Dec, 2017
Answer
1 Likes
Hi Marco,

I checked your forms!

Actually the behavior of the "Insert form" is unexpected, it should not handle the array value passed by the multi select.

The way to handle this is to add this code in the "special fields" box:
select/json

This converts the multi select values to a json encoded list of variables.

You can also add the same string in the special fields box of the "Read data" in order to decode the data again when reading it, instead of using PHP code to decode the data.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rmpaolillo 06 Dec, 2017
1 Likes
Thank you Max,

you hint solved this post.

BTW, in the "data save" action in the "insert form", I did not add any code in the "special fields" box.
I did it in the "data save" action in the "update form" using
select/json

and I used the
{var:read_data4.Data4.select}
in the "select" field as you suggested removing the custom php to decode the data.
Do not know why this is not working exactly how you suggested (if I understand what you mean in your latest reply). Hope this is not related to PDO extension version on the server I am working on.
What is important is that it is now working as expected without any flaws..apparently :-).

I am enclosing the updated version of the forms to help other users.

Thanks again.

Marco
Max_admin 29 Dec, 2017
1 Likes
Hi Marco,

Great, thank you for posting the full setup!🙂

Happy new year!

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.