Question
dollarFormat / numberformat problem
There has to be a super simple answer to this, I just cant
find it.
In my classifieds when people enter a number, some will enter 1000, some will enter 1,000, some will enter 1,000.00
now when I try to DollarFormat 1000 works but the rest dont. I've tried different varaitions, using numberFormat, find and replace comma...everything just gives me more trouble.. here is the closest I've gotten.
<cfform action="test.cfm" method="post"><cfinput name="price" type="text" validate="float" align="right" /><cfinput name="submit" type="submit" /></cfform>
<br />
<br />
<cfif isDefined("submit")>
</cfif>
<hr />
<cfoutput>
<cfif listlen(price,",") GT 1>
<cfset newstr = rereplace(#form.price#, "[^0-9]+", "", "All")>
<cfset newerstr = (newstr / 100) >
PRICE #form.price#<br />
NEWRSTR #newerstr#<br />
a. #numberFormat(newerstr, '999,999,999.99')#
<cfelse>
b. #numberFormat(price, '999,999,999.99')#</cfif>
</cfoutput>
any help would be appriciated
C.
In my classifieds when people enter a number, some will enter 1000, some will enter 1,000, some will enter 1,000.00
now when I try to DollarFormat 1000 works but the rest dont. I've tried different varaitions, using numberFormat, find and replace comma...everything just gives me more trouble.. here is the closest I've gotten.
<cfform action="test.cfm" method="post"><cfinput name="price" type="text" validate="float" align="right" /><cfinput name="submit" type="submit" /></cfform>
<br />
<br />
<cfif isDefined("submit")>
</cfif>
<hr />
<cfoutput>
<cfif listlen(price,",") GT 1>
<cfset newstr = rereplace(#form.price#, "[^0-9]+", "", "All")>
<cfset newerstr = (newstr / 100) >
PRICE #form.price#<br />
NEWRSTR #newerstr#<br />
a. #numberFormat(newerstr, '999,999,999.99')#
<cfelse>
b. #numberFormat(price, '999,999,999.99')#</cfif>
</cfoutput>
any help would be appriciated
C.
