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 <morni...@gmail.com> wrote: > $('input[name=piResults]').fieldValue() > > ".fieldValue()" ? > > Why aren't you just using ".val()" ? > > On Jun 12, 9:16 am, John <jmcl...@birchrunsoccer.org> 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 number > > field. I have a submit button that is linked to jquery form plugin. > > My validation is checked on "beforeSubmit". ( i.e. beforeSubmit: > > validateForm ) > > I've used validateForm() for other simple validation via javascript. > > This time I'm using jQuery Form which shouldn't be and isn't a > > problem. My issue is in the validation of phone number. > > > Within validateForm is this... > > > function validateForm(formData, jqForm, options) { > > > var queryString = $.param(formData); > > alert(queryString); > > > // VALIDATE ENTIRE FORM > > //phone > > if (validate_phone($('input[name=piResults]').fieldValue(), > > "Please > > enter a valid phone number.") == false){ > > phoneNum.focus(); > > return false; > > } > > > } > > > // VALIDATE PHONE NUMBER > > function validate_phone(value,alerttxt){ > > > var re = /^\(\d{3}\)\d{3}-\d{4}$/; > > > if( value.match(/^\(\d{3}\)\d{3}-\d{4}$/) ){ > > return false; > > } > > else{ > > return true; > > } > > > } > > > When validate_phone is called, the parameter "value" is correct. The > > problem is the "match" is not checked. > > Is there another way? > > > Thanks for any help. > > > J Mcleod