Parameter 1 of function DollarFormat; must be a number

Posted on 2006-03-21
Medium Priority
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
  • 2
LVL 25

Expert Comment

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

Accepted Solution

dgrafx earned 1400 total points
ID: 16253741
Thinking about it - I think I can guess whats up.
Use #dollarformat(rereplace(form.amount,"(\$)|(,)","","all"))#
LVL 18

Assisted Solution

Plucka earned 600 total points
ID: 16253744

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

ID: 16253800

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

850 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