Jim
>
> Below is part of a form I use to simply multiply a quantity times
> unit cost.
> The problem is that when the customer keys in a comma as in 4,000
> instead of
> 4000 a multiplication error occurs. I get an answer but it is way wrong.
> What can I do to strip the comma out???
>
>
> <tr>
> <CFIF Len(Trim(form.qty1)) AND Len(Trim(form.unitcost1))>
> <cfset form.totalcost = #form.qty# * #form.unitcost#>
> <td><input name="unitcost" value="#form.unitcost#"></td>
> </tr>
> </CFIF>
>
Why don't you convert them to numbers???
<cfif IsNumeric(form.qty1) and IsNumeric(form.unitcost1)>
<tr>
<cfset form.totalcost = val(form.qty1) * val(form.unitcost1)>
<td><input name="unitcost" value="<cfoutput>#form.unitcost1#</cfoutput>
</tr>
</cfif>
Incidently, watch your tag nesting.....
In your code you have an overlaping <Cfif> and <tr> if the <Cfif> fails
you'll windup with a <tr> floating around on its own.
Regards
Stephen
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.