Original Message:
> From: "Robert Orlini"

> Why am I getting this error? What does it mean please?
>
> An error occurred while evaluating the _expression_:
> session.item=#ArrayDeleteAt(session.item,1)#
> Parameter 1 of function ArrayDeleteAt which is now "YES" must be an array. The error occurred while processing an element with a general identifier of (CFSET),
>
> I want to delete a row in the Array and am using this code after user clicks the "remove" button:
>
> <CFIF IsDefined("form.remove.x")>
> <CFSET session.item=#ArrayDeleteAt(session.item,1)#>
> </cfif>

ArrayDeleteAt() returns "Yes" when it completes.  So, in your code, once you delete from the array once, session.item is no longer an array, but is "Yes". So, the next time that ArrayDeleteAt() code runs, session.item is not an array and throws the error you got.

Change your cfset to something like

<cfset tmp = ArrayDeleteAt(session.item,1)>

(I'm not sure, but I don't even think you need the "tmp =" in there, but I always do it to be safe)

Scott

---------------------------
Scott Brady
http://www.scottbrady.net/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to