Parameter 1 of function DollarFormat; must be a number

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)#">
<CFELSE>
$<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!">
</CFIF>

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?
 
JohnLucaniaAsked:
Who is Participating?
 
dgrafxCommented:
Thinking about it - I think I can guess whats up.
Use #dollarformat(rereplace(form.amount,"(\$)|(,)","","all"))#
0
 
dgrafxCommented:
Why not just do #DollarFormat(form.amount)#?
What is it you are trying to do?
0
 
PluckaCommented:
JohnLucania,

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.

Regards
Plucka
0
 
JohnLucaniaAuthor Commented:
Great!!!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.