Try this
<cfset form.QTY = replace(form.QTY, ",,", ",0,", "ALL") /> <cfset aQTYs = listToArray(form.QTY)> That should do it Regards Dale Fraser http://dalefraser.blogspot.com From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Scott Sent: Sunday, 8 July 2007 11:59 AM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Text Box & Arrays. This is your problem. <cfset aQTYs = listToArray(VAL(#form.QTY#))> Val will only work o single elements, not a list otherwise the list (entire list) will be truncated to a single value. On 7/8/07, TJS <[EMAIL PROTECTED]> wrote: To the people that responded to my question Friday evening and Saturday (Andrew, Steve & Dale) - a sincere thanks! Thanks for the expedient reply!! Whilst there seemed like a few good suggestions, it didn't quite solve the problem. So, if I can shed some more light on the scene, hopefully someone can tell me what I am doing wrong:- Okay. I have two pages:- 1. The first page contains a CFFORM that has passes two form values. One is a HIDDEN called "SKU". The other is a textbox that allows a person to specify the quantity of a product they want. It is called "QTY". Presently, I encounter no problems if I set a default value for the QTY textfield to 0. When the form is submitted, there is equal number of SKU and QTY values being passed to populate the array on the receiving page. What I would like to do is remove the default 0 value fom the QTY textfield so that the user sees and empty blank box instead of a 0 value. 2. On the receiving page, I have the following code:- ... ... <cfif isDefined("form.SKU")> <!---Run a Loop to Read-In Items to Cart---> <cfset aSKUs = listToArray(#form.SKU#)> <cfset aQTYs = listToArray(VAL(#form.QTY#))> <cfset cart = createObject("component", "SessionMyCart")> <cfloop from="1" to="#arrayLen(aSKUs)#" index="i"> <cfif #aQTYs[i]# GT 0> <cfinvoke component="#cart#" method="add" sku="#aSKUs[i]#" qty="#aQTYs[i]#"> <cfelse> <cfinvoke component="#cart#" method="update" sku="#aSKUs[i]#" qty="#aQTYs[i]#"> </cfif> </cfloop> </cfif> As you can see here, the form values are loaded into an array, which populate the cart. But the issue here is, back on page 1, if I DON'T specify 0 as a default value for the QTY textfield, I get the following error message:- " The element at position 2 of dimension 1, of array variable "AQTYS," cannot be found. " If anyone has any further ideas or suggestions on how I can resolve this issue, please let me know. Cheers, Travis. -- Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en -~----------~----~----~----~------~----~------~--~---