[jQuery] Re: Regular Expressions and jQuery

2009-06-14 Thread MorningZ
"I think you're looking for a test() method instead! match() is used to extract substrings from a given string" and will still evaluate to "true" in an if statement that's not the issue On Jun 13, 11:44 pm, Orkan wrote: > PS. the correct phone number for your regex is, for example: (123) >

[jQuery] Re: Regular Expressions and jQuery

2009-06-13 Thread Orkan
PS. the correct phone number for your regex is, for example: (123) 456-7890 right? On Jun 12, 3:57 pm, John wrote: > Good call. > > Here are my changes. > > function validate_phone(value,alerttxt){ > >         var re = /^\(\d{3}\)\d{3}-\d{4}$/; >         alert(re); > >         if( $('input[name=

[jQuery] Re: Regular Expressions and jQuery

2009-06-13 Thread Orkan
I think you're looking for a test() method instead! match() is used to extract substrings from a given string. function validate_phone(value,alerttxt){ var re = /^\(\d{3}\)\d{3}-\d{4}$/; var ok = re.test($("input[name=unitContactPhoneNumber]").fieldValue ()); alert(re +

[jQuery] Re: Regular Expressions and jQuery

2009-06-12 Thread John
Good call. Here are my changes. function validate_phone(value,alerttxt){ var re = /^\(\d{3}\)\d{3}-\d{4}$/; alert(re); if( $('input[name=unitContactPhoneNumber]').fieldValue().match(/^\(\d {3}\)\d{3}-\d{4}$/) ){ alert('match'); return tru

[jQuery] Re: Regular Expressions and jQuery

2009-06-12 Thread Michael Lawson
Maybe I'm reading this wrong, but the regular expression you are using looks like it returns a match on valid phone numbers? If that is the case why not return true when it matches, false when it doesn't. Ir just put a ! in front of the match function cheers Michael Lawson Development Lead, Glo

[jQuery] Re: Regular Expressions and jQuery

2009-06-12 Thread John
Thanks for the reply. 'fieldValue' is used in the jquery form plugin. When I use '.val()' for example: $('input[name=piResults]').val() I get nothing. On Jun 12, 9:33 am, MorningZ wrote: > $('input[name=piResults]').fieldValue() > > ".fieldValue()" ? > > Why aren't you just using ".val()" ?

[jQuery] Re: Regular Expressions and jQuery

2009-06-12 Thread MorningZ
$('input[name=piResults]').fieldValue() ".fieldValue()" ? Why aren't you just using ".val()" ? On Jun 12, 9:16 am, John wrote: > Hello all, > I have some experience in Regular Expressions but this one has me > pulling my hair out. > > I have a form with several input fields including a phone