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>
ColdFusion Language

Avatar of undefined
Last Comment
LelloLello

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
gdemaria

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
gdemaria

without dollar format, it would look like this:   1000

It is just a way of formatting a numer to look like money
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?
LelloLello

ASKER
could u pls advise on my other quesiton.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
gdemaria

>  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
LelloLello

ASKER
so i should keep i then thank u.