var reg = /([^0-9\.])/g;
var str = "$0.01";
var myValue = parseFloat(str.replace(reg,""))
alert(myValue>0.01);
Also, keep in mind that this will not catch invalid decimal amounts (like 3.1415, etc.) You'd need to get a bit more involved for that. I've written a _javascript_ 1.2 library that does these kinds of validations plus much more including JS versions of dozens of useful CF functions and it's fairly small (~20k). Let me know if you'd like a copy.
Chris
-----Original Message-----
From: Marlon Moyer [mailto:[EMAIL PROTECTED]
Sent: Friday, August 13, 2004 7:35 PM
To: CF-Talk
Subject: RE: _javascript_ Question.
put this into a function:
var reg = /([^0-9\.])/g;
var str = "$0.01";
var myValue = parseFloat(str.replace(reg,""))
alert(myValue>0);
> -----Original Message-----
> From: Tangorre, Michael [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 13, 2004 4:46 PM
> To: CF-Talk
> Subject: OT: _javascript_ Question.
>
> I have a money field that needs to be greater than $0.01. The field may
> or may not contain a dollar sign ($) and may or may not contain a
> period
> (.) as a dollar/cents split. When the form loads the default value is
> $0.00
>
> What would be the easiest way to verify the amount is greater than 1
> cent (0.01)... Using _javascript_ of course :-) ?
>
> Thanks!
>
> Mike
>
>
_____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

