Odd way of doing things?
I'd switch it to something like this:
cfif NOT REFind('[^0-9.$,]', Form.Sale_Price)
/cfif
Which (I think) can be translated into this JS:
if (sale_price.match(/[^0-9.$,]/) == false)
{
}
Hi, all.
I've been tinkering with validation using js and would
like to
You could even put the below in the onchange, so the user knows what's
gonna happen ahead of time. Assuming the below works. ;-)
On 3/10/07, Peter Boughton wrote:
Odd way of doing things?
I'd switch it to something like this:
cfif NOT REFind('[^0-9.$,]', Form.Sale_Price)
/cfif
I'm going to be using this regex in a validation plug-in
that works with jQuery.
I've got the plug-in working, I just need to add some additional
validation statements.
Is a JS statement that checks to see if an entry is in US dollars?
That would be the simplest thing to use... because, really,
Hi, Peter...
What my REReplace is doing is saying that
if, after taking out any periods, dollar signs, or commas,
the resulting entry is not numeric, then the entry is wrong.
If the entry only has digits, periods, dollars signs, or commas,
(I guess I'm hoping in the right places), then the entry
Rick,
Here's a similar statement that I use in my own jQuery validation
plug-in. It validates phone numbers saying basically, after stripping
out all the parenthesis and dashes, if the remaining is numeric, then
it's a good phone number...
else if (ThisDataType == phone $this.val()
Hi, Chris...
Thanks for the example code.
I searched for some info on the CFJS library, but didn't find
anything. Is that something you wrote? Where can I find some
info about it?
Rick
-Original Message-
From: Christopher Jordan [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 10,
-- Does your code ... ?
Yup.
-- If so, that would do the same thing.
Well it achieves the same result, but I would guess that just REFind is more
efficient than IsNumeric+REReplace.
-- Also, is that, then, what your JS version is doing?
Yup, variable.match(/.../) is the equivalent to
Thanks, Peter...
I figured it was doing the same thing and was probably a matter of
efficiency.
Now I'll see if I can figure out how to put your JS code into the jQuery
Validation plug-in
I'm using. This is my first attempt at validation using JS... I've been
doing it with CF,
which works fine,
8 matches
Mail list logo