On input, I would get all of the numbers to a consistent format.
First, I would remove $ and ,
<cfset BidAmount=Replace(Form.BidAmount,"$","","ALL")>
<cfset BidAmount=Replace(Variables.BidAmount,",","","ALL")>
Then if there was anything left besides numbers and a . I'd throw an
exception. Probably the easiest thing for that is
<cfif NOT IsNumeric(Variables.BidAmount)>
... error code ...
</cfif>
If all passes, then put that value in the database.
For output, just use DollarFormat().
> -----Original Message-----
> From: Dave Lyons [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 14, 2003 1:05 AM
> To: CF-Talk
> Subject: best way to enter currency format
>
>
> in this auction app i cant find a reasonable solution for the
> handling of the bids. I have been sitting here messing with a
> lot of the tags and it seems to me that they are very
> dependant on how the info was entered. With of course means
> that i need to format it going into the db and possibly coming out.
> will be using a ms access db. And yes I have tried to set the
> bid field to currency which just throws an error.
>
> And I cant format it coming out of the db unless the entries
> are in the same form going into the db.
> So is there a tag i have missed that would format it going in?
> understanding that some people might place bids in the following ways:
> (say user is bidding $1,000.00)
> $1,000.00
> $1,000
> $1000
> 1,000.00
> 1,000
> 1000
>
> any thoughts?
>
> dave
> <!--- doesnt know jack about cfm --->
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4