semicolons, semicolons  :-)

-----Original Message-----
From: Tim Do [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 3:46 PM
To: CF-Talk
Subject: RE: OT javascript addition


Hi Brook,
this is what I'm using but getting "expecting )" error... please help =)

function validate()
{
        var sumValue =
eval(document.newBillingInfo.SCEPbilledAmount.value.valueOf()) +
eval(document newBillingInfo.SCEPpenaltyAmount.value.valueOf()) +
eval(document newBillingInfo.SCEPdelinquentAmount.value.valueOf())

        var total =  eval("document.newBillingInfo.SCEPtotalAmount.value")
        if (sumValue != total)
        {
        alert(sumValue)
        document.newBillingInfo.SCEPbilledAmount.focus()
        return false;
        }       
        
        return true;
        
}

-----Original Message-----
From: Brook Davies [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 12:38 PM
To: CF-Talk
Subject: RE: OT javascript addition


I had the same problem the other day. This works FOR SURE:

eval(document.newBillingInfo.SCEPbilledAmount.value.valueOf())+eval(document

newBillingInfo.SCEPpenaltyAmount.value.valueOf())

Using the valueOf() function converts a string to a number.

Brook Davies
maracasmedia.com



At 12:13 PM 23/07/02 -0700, you wrote:
>Try doing eval(document.newBillingInfo.SCEPbilledAmount.value) +
>eval(document.newBillIngo.SCEPpenaltyAmount.value), etc.  At least in
>ActionScript (Flash) this forces the value to be treated as a number for
>addition purposes.  A quick test in IE javascript showed it to work there
>also.
>
>Dan
>
>-----Original Message-----
>From: Tim Do [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 23, 2002 11:30 AM
>To: CF-Talk
>Subject: RE: OT javascript addition
>
>
>Thanks Stephen.. I tried that earlier but that only concatenates it
>
>-----Original Message-----
>From: Stephen Kellogg [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 23, 2002 10:08 AM
>To: CF-Talk
>Subject: RE: OT javascript addition
>
>
>Tim,
>try adding () around the addition part like so:
>
>if ((document.newBillingInfo.SCEPbilledAmount.value +
>document.newBillingInfo.SCEPpenaltyAmount.value +
>document.newBillingInfo.SCEPdelinquentAmount.value) !=
>document.newBillingInfo.SCEPtotalAmount.value)
>
>
>This should force the addition to take place before the comparison.
>
>PS are you checking for numeric input only
>
>This could be done like so:
>
>if ((isNaN(document.newBillingInfo.SCEPbilledAmount.value)) ||
>(isNaN(document.newBillingInfo.SCEPpenaltyAmount.value))  ||
>(isNaN(document.newBillingInfo.SCEPdelinquentAmount.value))  ||
>(isNaN(document.newBillingInfo.SCEPtotalAmount.value))
>         {
>         alert("The amounts must be numeric, Please
>check the values.")
>         document.newBillingInfo.SCEPbilledAmount.focus()
>         return false;
>         }
>else
>         {
>if ((document.newBillingInfo.SCEPbilledAmount.value +
>document.newBillingInfo.SCEPpenaltyAmount.value +
>document.newBillingInfo.SCEPdelinquentAmount.value) !=
>document.newBillingInfo.SCEPtotalAmount.value)
>         {
>         alert("The total Billing amount does not add up correctly, Please
>check the values.")
>         document.newBillingInfo.SCEPbilledAmount.focus()
>         return false;
>         }
>
>         return true;
>         }
>}
>
>
>or something like that ;-)
>
>this is untested code but hopefully will give you something to work with.
>
>HTH
>
>Stephen
>
>-----Original Message-----
>From: Tim Do [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, July 23, 2002 12:36 PM
>To: CF-Talk
>Subject: javascript addition
>
>
>Hello,
>
>Can anybody show me how you would I would validate the sum of several text
>boxes?  This is what I'm trying to use but not having luck.. thanks in
>advance.
>
>function validate()
>{
>  if (document.newBillingInfo.SCEPbilledAmount.value +
>document.newBillingInfo.SCEPpenaltyAmount.value +
>document.newBillingInfo.SCEPdelinquentAmount.value !=
>document.newBillingInfo.SCEPtotalAmount.value)
>         {
>         alert("The total Billing amount does not add up correctly, Please
>check the values.")
>         document.newBillingInfo.SCEPbilledAmount.focus()
>         return false;
>         }
>
>         return true;
>
>}
>
>
>
>


______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to