Link to home
Get AccessLog in
Avatar of LelloLello
LelloLello

asked on

#DollarFormat(intTotal)# in coldfusion?

I have a question what the #DollarFormat do in my CFMAIL ? and why I need it.

<cfmail from="#form.strEmail#"
                                    " type="html">
-------------------------<br>
Name: #strBadgeName#  <br>
Company:  #FORM.strCompany#<br>
Address: #FORM.strAddress# #FORM.strCity# #FORM.strProvince# #FORM.strPostal#
Phone: #FORM.strPhone#<br>
Fax: #FORM.strFax#<br>
Email: #Form.strEmail#<br>
-------------------------<br>
Registration Information:<br>
-------------------------<br>
Subtotal: #DollarFormat(intSubTotal)#<br>
#tax_label#: #DollarFormat(intGST)#<br>
Tax Exempt: #intGSTNumber#<br>
Total: #DollarFormat(intTotal)#<br>
ASKER CERTIFIED SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
without dollar format, it would look like this:   1000

It is just a way of formatting a numer to look like money
Avatar of LelloLello
LelloLello

ASKER

okay... this is my front end page:

<fieldset><legend>Registration Fees</legend>
                                          
                              <br>
                   
                   <table border="0" cellspacing="0" cellpadding="0" width="100%">
                              <tr>
                                    <td width="98%" valign="top"><label for="intOption575">Subscription</label></td>
                                    <td width="1%"><cfoutput><cfset intRate = int(val(getRates.rate))>
<input type="radio" name="intOption" id="intOption575" value="#intRate#"  onClick="Calculate_Sub_Total(this)" class="formWidget"></cfoutput></td>
                                    <td width="5"><img src="images/spacer.gif" height="1" width="5" border="0" alt=""></td>
                                    <td width="1%" nowrap><label for="intOption575">$<cfoutput query="getrates">#getRates.rate#</cfoutput></label><cfoutput><input type="hidden" name="intOption" id="intOption1" value="#intRate#"  class="formWidget"></cfoutput></td>
                              </tr>

this is the backend...

<!---get rates--->
<cfset today = parseDateTime(dateFormat(now(), "yyyy-mm-dd"))>
<cfquery name="GetRates" datasource="#application.datasource#" username="#application.username#" password="#application.password#">
  SELECT *
  FROM CIANET_Rates
  where startDate <= #today#
AND    (     endDate >= #today#  OR  endDate is NULL )
</cfquery>

      <cfset intSave_val = 0>
<cfset intSubTotal = #getRates.rate# >

So in my cfmail function
Subtotal: #DollarFormat(intSubTotal)#
#tax_label#: #DollarFormat(intGST)#
Tax Exempt: #intGSTNumber#
Total: #DollarFormat(intTotal)#

I have to take out the dollarformat because it gave me error. any idea?
could u pls advise on my other quesiton.
>  have to take out the dollarformat because it gave me error. any idea?

I think the only way for it to error is if the value passed is not a number

You can ensure it is a number by using val()  

    DollarFormat(val(intSubTotal))

but that may hide bugs if the value is not correct
so i should keep i then thank u.