CAN'T SET UP A FORM FIELD TO ACCEPT NUMBERS

R

Ray

I have created a form in FP 2000 that includes fields for
phone numbers. I just upgraded to FP2003 and although
I've followed all instructions available to me, the phone
number fields still won't accept numbers exclusively.
Still accepting text.
 
K

Kevin Spencer

Do you have a URL we could look at?

Possible reasons for your problem:

1. JavaScript disabled on the browser.
2. Incorrectly followed instructions.

If I could look at your page I could tell you very quickly.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
K

Kevin Spencer

Hi Ray,

I went to the site, and the validation is working. The validation for the
HomePhone field is as follows:

var checkOK = "0123456789-.";
var checkStr = theForm.Home_Phone.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else
allNum += ch;
}

Note that it allows the hyphen as well as digits. Otherwise, it will not
allow the form to submit unless there is a value in the field, and that
value contains only characters in the checkOK variable, which includes the
numbers 0-9 and the hyphen.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top