Copy link to clipboard
Copied
I was recently forced due to company policy to upgrade from CF8 to CF10. When I did so, a number of things naturally broke.
Specifically, I have some cfloop code that is now throwing a "Complex object types cannot be converted to simple values" where it didn't before. This is driving me mad. Must be something simple I'm missing.
The gist of it is that I have a multi-select listbox (sorted with some javascript I found online) passing a comma-delimited list of numbers as the "FORM.list" value to the loop.
Here is the code:
<cfif isDefined("FORM.list")>
<cfloop list="#FORM.list#" delimiters="," index="i">
<cfquery name="somename" datasource="#datasource#">
UPDATE STATEMENT (some query code)
WHERE some_id = #i#</cfquery>
</cfloop>
</cfif>
When one item is selected in the form list, the code works fine. When I multi-select two or more items from the multi-select box, it throws:
"Complex object types cannot be converted to simple values."
All that's in the passed form values are numbers: e.g. "123456,234532".
Does anyone know what's going on so I can stop pulling my hair out?
Thanks!
Hi Adam, thank you very much for your reply.
Problem has been resolved. I had only applied the mandatory update, and couldn't figure out why the auto updater wasn't seeing any patches so I thought maybe I was good. At your suggestion, and a little more research, I realized I was not nearly up to date. Found out I needed to add the proxy settings to the CF config and then all the updates appeared. So once I patched the server properly, the cfloop problems went away. Go figure.
Many thanks for
...Copy link to clipboard
Copied
If you dump the form scope, are those numbers presented as a list or an array?
Do you have the thissameFormFieldsAsArray setting set to true in Application.cfc?
Recommend you put a try/catch around the erroring code, and dump out all the contributing variables to determine which variables don't have the values you expect.
Also: is your CF10 server fully patched to 10.0.11?
--
Adam
Copy link to clipboard
Copied
Hi Adam, thank you very much for your reply.
Problem has been resolved. I had only applied the mandatory update, and couldn't figure out why the auto updater wasn't seeing any patches so I thought maybe I was good. At your suggestion, and a little more research, I realized I was not nearly up to date. Found out I needed to add the proxy settings to the CF config and then all the updates appeared. So once I patched the server properly, the cfloop problems went away. Go figure.
Many thanks for your prompt and helpful suggestions. Glad this prompted me to get the auto-updater working as well.
Tony