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() != ""){
            var phoneNumber = $this.val();
            if(!CFJS.IsNumeric(phoneNumber.replace(/[\(\)\- ]/g, ""))){
                InvalidPhoneNumberFound = true;
                if(SwitchStyles){
                    ValidationStyleSwitch($this);
                }
            }
        }

I'm using another library of functions meant to give javascript some 
nice CF functionality. That's the CFJS.IsNumeric() function. Let me know 
if this helps or if you want the CFJS library.

Chris

Rick Faircloth wrote:
> 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, if
> a person were to accidentally enter 4$00,000.00 instead of $400,000.00,
> then I'd still have a validation problem most likely.  Haven't used JS
> like this before, so I'm not sure how code will respond to various
> entries.
>
> Rick
>
>
>
> -----Original Message-----
> From: Dinner [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, March 10, 2007 4:02 PM
> To: CF-Talk
> Subject: Re: How to turn this into a REGEX for use in javascript?
>
> 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>
>>
>> Which (I think) can be translated into this JS:
>> if (sale_price.match(/[^0-9.$,]/) == false)
>> {
>> ....
>> }
>>
>>
>>     
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272285
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to