Hello:
Sorry, I forgot the subject in my last post.
I'm having an issue deleting a form structure that is in a shopping cart
array.
I'm sure it's something simple I'm doing wrong, but it's driving me crazy.
I have a checkbox to select which items to delete.
If only one item is selected there is no error and it works fine.
If more than one item is selected then the error is triggered.
Strangely, if I resubmit the form after the error it works OK.
If I select two items to delete the error is:
The error message is " Element at position [3] doesn't exist in array"
Here is the form code:
<cfloop from="1" to="#arrayLen(session.shoppingcart)#" index="i">
<tr>
<td>
<cfinput type="checkbox" value="#i#" name="itemid#i#">
</td>
<td>
<cfinput type="text" name="quantity#i#"
value="#session.shoppingcart[i].quantity#" size="3">
</td>
<td>
<cfinput type="text" name="catalogno#i#"
value="#HTMLEditFormat(session.shoppingcart[i].catalog)#" size="10">
</td>
<td>
<cfinput type="text" name="description#i#"
value="#HTMLEditFormat(session.shoppingcart[i].description)#"
size="40"></td>
<td>
<cfinput type="text" name="price#i#"
value="#session.shoppingcart[i].price#" size="3">
</td>
</tr>
</cfloop>
Here is the cfc code:
<cfloop from="1" to="#arrayLen(session.shoppingcart)#" index="i">
<cfif StructKeyExists(rc,"itemid" & i)>
<cfset private.temp = arrayDeleteAt(session.shoppingcart,i)>
</cfif>
</cfloop>
Any help is greatly appreciated.
Regards,
Jaime
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329595
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4