nevermind.
I should have used

var re = new RegExp(/^\d+$/);


>>> "Scott Thornton" <[EMAIL PROTECTED]> 10/06/2008 2:40 pm >>>

Hi,

Trying to write a little Javascript to validate a field.

I want to have the field contain numeric info only.

My script

                var re = new RegExp(^\d+$);
                
                if( field_value.match( re ) )
                {
                        alert('True: does not contain anything but a number');
                }
                else
                {
                        alert('False contains stuff other then just numbers');
                }


the regex ^\d+$ works fine when tested on the website 
http://www.regular-expressions.info/javascriptexample.html 

but the above line var re = new RegExp(^\d+$); gives me a syntax error in 
Firefox.

Thanks,







--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to