Can't cast Complex Object Type Struct to String

Hi,
Still ironing out thing from migrating my site from cf10 to lucee .

The latest issue is this error:
Lucee 4.5.1.024 Error (expression)
Message Can’t cast Complex Object Type Struct to StringDetailUse
Built-In-Function “serialize(Struct):String” to create a String from Struct

The code that get this error is:
<cfif isDefined(‘form.fieldnames’)>

",">","all")>

How do I fix this?
Thank you,
Dominique

First of all, there is an error in your code: the without an opening tag, inside the loop. Fix that one before anything else.

Second. It appears to me that the error is throwing because form.fieldnames is a struct, rather than a string. Dump it to find out but, if it’s a struct, you’ll need to use via the collection parameters.

JonOn November 7, 2015 at 2:18:04 PM, Dominique Dupuis (@Dominique_Dupuis) wrote:

Hi,
Still ironing out thing from migrating my site from cf10 to lucee .

The latest issue is this error:
Lucee 4.5.1.024 Error (expression)
Message Can’t cast Complex Object Type Struct to String
Detail Use Built-In-Function “serialize(Struct):String” to create a String from Struct

The code that get this error is:
<cfif isDefined(‘form.fieldnames’)>

",">","all")>

How do I fix this?
Thank you,
Dominique

Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/2ddd4613-cd9c-438d-8e79-d66c736f46ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

The reason for this definitely is that some of the form keys contain structs. Like for instance if you click an image form button.
This is for the reason that acf is then sending the image button as form[‘image.x’] and y. They contain the position of the mouse, when clicked on the image button. So you should also check for whether a key contains a struct.

Just dump the form and then you’ll see it.

GertSent from somewhere on the road

Am 07.11.2015 um 14:18 schrieb Dominique Dupuis <@Dominique_Dupuis>:

Hi,
Still ironing out thing from migrating my site from cf10 to lucee .

The latest issue is this error:
Lucee 4.5.1.024 Error (expression)
Message Can’t cast Complex Object Type Struct to String
Detail Use Built-In-Function “serialize(Struct):String” to create a String from Struct

The code that get this error is:
<cfif isDefined(‘form.fieldnames’)>
<!— clean up form submissions —>

<!— clean up each value —>
<cfset form[f] = Replace(form[f],“<”,“<”,“all”)>
<cfset form[f] = Replace(form[f],“>”,“>”,“all”)>
<cfset form[f] = Replace(form[f],‘"’,“"”,“all”)>


How do I fix this?
Thank you,
Dominique

Love Lucee? Become a supporter and be part of the Lucee project today! - http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/2ddd4613-cd9c-438d-8e79-d66c736f46ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

For the /cfif, sorry, I only forgot to remove it on pasting the code for
the post That cfif tag was removed from the post since it had no relevance
in the problem or in understanding the context.

As for the code itself, this is a reusable func to clean up form
submissions. So form.fieldnames could be only one form field name (string)
(lets say customer_note_name) , or a comma-delimited list of form field
names, but still a string (like in the dump below).
In this case the returns: string:
cw_customers_notes.customer_Note_date_added,cw_customers_notes,AddCustomerNote,customer_Note,customer_Note_status,customer_Note_origin,customer_id

DominiqueOn Saturday, November 7, 2015 at 2:31:40 PM UTC-5, Jon Clausen wrote:

First of all, there is an error in your code: the without an
opening tag, inside the loop. Fix that one before anything else.

Second. It appears to me that the error is throwing because
form.fieldnames is a struct, rather than a string. Dump it to find out
but, if it’s a struct, you’ll need to use via the collection
parameters.

Jon

On November 7, 2015 at 2:18:04 PM, Dominique Dupuis (domini...@gmail.com <javascript:>) wrote:

Hi,
Still ironing out thing from migrating my site from cf10 to lucee .

The latest issue is this error:
Lucee 4.5.1.024 Error (expression)
Message Can’t cast Complex Object Type Struct to String Detail Use
Built-In-Function “serialize(Struct):String” to create a String from Struct

The code that get this error is:
<cfif isDefined(‘form.fieldnames’)>

",">","all")>

How do I fix this?
Thank you,
Dominique

Love Lucee? Become a supporter and be part of the Lucee project today! -
http://lucee.org/supporters/become-a-supporter.html

You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/2ddd4613-cd9c-438d-8e79-d66c736f46ab%40googlegroups.com
https://groups.google.com/d/msgid/lucee/2ddd4613-cd9c-438d-8e79-d66c736f46ab%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.