Having to remove commas from a writer's story isn't exactly the best way to
approach this.
<cfset FormFieldList = ListAppend(FormFieldList,
evaluate("form.#ItemName#"))>
Is FormFieldList really supposed to contain the _contents_ of the form
fields? Seems rather redundant. The problem you run into is that if any of
the form field contents contains a comma, you get unexpected results,
possibly errors. In any case, you might fix this by using an odd character
to delimit this list. Choose an extended or an unprintable ASCII character,
something like Chr(233) (whatever that is).
<cfset ffldelim = Chr(233)>
<cfset FormFieldList = ListAppend(FormFieldList,
Evaluate("form.#ItemName#"), "#ffldelim#")>
Then, whenever you work with this list, make sure you remember to use that
delimiter.
Jim
----- Original Message -----
From: "Dave Douglas" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, February 01, 2002 6:49 PM
Subject: Replacing Commas in a Form Field to keep list from Bombing
> Hello,
>
> I've been assigned the task to fix A news app which takes uploaded stories
> (among other things that is why it is all dynamic) blows up when users
have
> a comma in their story. I am completely new to the code and a little
(maybe
> a lot) lost.
> The user enters the Headline, Writer, and Story in a form, when their is
no
> commas in story all works fine, but when there is commas it errors:
> An error occurred while evaluating the expression:
>
>
> #ListGetAt(DBFieldList,num)#
>
> The code that is sending the commas as separate list items is:
> <cfloop list="#QGetContentItem.ContentItemFieldList#" index="CurrentItem"
> delimiters=":"> <cfset ItemName=ListGetAt(CurrentItem,1,';')> <cfset
> FormFieldList=ListAppend(FormFieldList,evaluate("form.#ItemName#"))>
<cfset
> DBFieldList=ListAppend(DBFieldList,ItemName)> </cfloop>
>
> so I tried
> <cfset NoCommas=#Replace("ItemName",",","^","ALL")>
> so as to use a less often carat character and remove the commas, but am
> completely stuck
> after trying to put it in all kinds of places.
> Any Takers?
> Thanks!
> Dave
>
>
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists