Parameter 1 of function DollarFormat; must be a number

Posted on 2006-03-21
Last Modified: 2013-12-24
I have:

<B>Gift Amount</B> <CFPARAM name="form.Amount" default=0>
<CFIF session.myTransactionMode eq "addPayment" AND session.myPaymentID neq "">
$<cfinput name="myAmount" value="#Right(DollarFOrmat(form.Amount),Len(DollarFOrmat(form.Amount))-1)#" tabindex="#myTab#"
type="text" id="myAmount" size="10" class=notetext2 validate="regular_expression"  disabled
pattern="^\d+\.?\d{1,2}?$" message="Please double-check the Amount you entered!">
<INPUT type=hidden name=Amount value="#Right(DollarFOrmat(form.Amount),Len(DollarFOrmat(form.Amount))-1)#">
$<cfinput name="Amount" value="#Right(DollarFOrmat(form.Amount),Len(DollarFOrmat(form.Amount))-1)#" tabindex="#myTab#"      type="text" id="Amount" size="10" class=notetext2 validate="regular_expression"
pattern="^\d+\.?\d{1,2}?$" message="Please double-check the Amount you entered!">

and I am getting:

Parameter 1 of function DollarFormat which is now 3,000.00 must be a number  
The error occurred in line 41

39 : <INPUT type=hidden name=Amount value="#Right(DollarFOrmat(form.Amount),Len(DollarFOrmat(form.Amount))-1)#">
40 : <CFELSE>
41 : $<cfinput name="Amount" value="#Right(DollarFOrmat(form.Amount),Len(DollarFOrmat(form.Amount))-1)#" tabindex="#myTab#"
42 : type="text" id="Amount" size="10" class=notetext2 validate="regular_expression"
43 : pattern="^\d+\.?\d{1,2}?$" message="Please double-check the Amount you entered!"

What is wrong with this?
Question by:JohnLucania
    LVL 24

    Expert Comment

    Why not just do #DollarFormat(form.amount)#?
    What is it you are trying to do?
    LVL 24

    Accepted Solution

    Thinking about it - I think I can guess whats up.
    Use #dollarformat(rereplace(form.amount,"(\$)|(,)","","all"))#
    LVL 18

    Assisted Solution


    It's saying that form.Amount is 3,000.00 and it doesn't like commas.

    <cfset form.Amount = replace(form.Amount, ",", "", "all") />

    Put this above line 39 and all should be sweet.


    Author Comment


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
    Article by: kevp75
    Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now