I'm back with something that makes no sense to me .... as far as I can see
the three if statements are identical except for the input. One is the
regular phone, then cell phone and then the fax .....

function validForm( passform) {
<< other validation skipped >>
re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validPhone = re.exec(passForm.fldPhone.value);
if ( validPhone ) {
passForm.fldPhone.value = "(" + validPhone[1] + ") " + validPhone[2] +
"-" + validPhone[3];
}
else {
errList += " a valid phone number\n";
if (!hasError) {
passForm.fldPhone.focus();
hasError = true;
}
}
if ( passForm.fldCell.length > 0) {
recell = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validCell = recell.exec(passForm.fldCell.value);
if ( validCell ) {
passForm.fldCell.value = "(" + validCell[1] + ") " + validCell[2] + "-"
+ validCell[3];
}
else {
errList += " if entered the cell must be a valid phone number\n";
if (!hasError) {
passForm.fldCell.focus();
hasError = true;
}
}
}
if ( passForm.fldFax.length > 0) {
refax = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
validFax = refax.exec(passForm.fldFax.value);
if ( validFax ) {
passForm.fldFax.value = "(" + validFax[1] + ") " + validFax[2] + "-" +
validFax[3];
}
else {
errList += " if entered the fax must be a valid phone number\n";
if (!hasError) {
passForm.fldFax.focus();
hasError = true;
}
}
}
<< handle the error and redirect to the next form >>
}

THey shouldbe identical since I copied the first one and made the requisit
changes for the cell and fax. However the output (as show in the session
variables into which they are stashed)

Session("svPersonPhone") = Request.Form("fldPhone")
Session("svPersonCell") = Request.Form("fldCell")
Session("svPersonFax") = Request.Form("fldFax")

show up as follows:

SVPERSONZIPCODE - 123451234
SVPERSONPHONE - (123) 123-1234
SVPERSONCELL - 4564564567 <<== notice not formatted ...
SVPERSONFAX - 7897987890
SVPERSONEMAIL -

initially the regular expressions were all just 're' then when I started
looking at this I changed them to 'recell' and 'refax' on the off chance
that there might be a funny in re-using a regular expression.

as always other comments are appreciated, but please also address this
issue. ((I know "picky, picky...."))

Re: regular expressions by Ray

Ray
Wed Sep 08 22:56:07 CDT 2004

You may want to inquire in a jscript group.

Ray at home

"Al Jones" <aljones@yahoo.com> wrote in message
news:O9LsPodlEHA.3912@TK2MSFTNGP12.phx.gbl...
> I'm back with something that makes no sense to me .... as far as I can
see
> the three if statements are identical except for the input. One is the
> regular phone, then cell phone and then the fax .....
>
> function validForm( passform) {
> << other validation skipped >>
> re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
> validPhone = re.exec(passFor



Re: regular expressions by Al

Al
Wed Sep 08 23:16:13 CDT 2004

Done ..... my other questions have been vbscript related (and session
variables) so just naturally migrated here, thanks for the 'suggestion'

//al


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:ej64QDilEHA.3536@TK2MSFTNGP12.phx.gbl...
> You may want to inquire in a jscript group.
>
> Ray at home
>
> "Al Jones" <aljones@yahoo.com> wrote in message
> news:O9LsPodlEHA.3912@TK2MSFTNGP12.phx.gbl...
>> I'm back with something that makes no sense to me .... as far as I can
> see
>> the three if statements are identical except for the input. One is the
>> regular phone, then cell phone and then the fax .....
>>
>> function validForm( passform) {
>> << other validation skipped >>
>> re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/
>> validPhone = re.exec(passFor
>
>