Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting 07... in Form Field Validation

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi All

I have a telephone number field on an enquiry form and I'm trying to find out how to detect when the first two numbers are 07 (Zero Seven) before the form is submitted which in turns stops it and the user has to enter another number. The data values only allow greater than etc so if you enter a valid number, for example 01234... etc then this procedure is no good.

The whole idea is stop anyone posting a mobile telephone number (In the UK) as they now all start with 07.
Any suggestion please?

Many thanks
KB

When everything else is said and done, there will be nothing else to say or do
 
Not being familiar with valid UK phone numbers, here is a suggestion. In the US the phone numbers are basically in this format:
###-###-####

If I wanted to prevent someone from posting a phone number where the first 3 digits are 007, I would create 3 fields in the form for the phone number. AreaCode - Prefix - last4digits. On the AreaCode field, I would set the validation to:
Data Type: Integer
Data Length: Required - MAX length: 3
Data Value: checked
"Field Must Be" : NOT EQUAL TO
Value: 007

That should make it OK to enter other 3 digit combinations, but reject any 007 entries.
I would suggest a notice on the form page that "mobile telephone numbers are not acceptable"

HTH
Tiffany

Microsoft MVP - FrontPage
 
Hi Noconi

Many thanks for taking the time to reply and I'll try out what you have suggested.

Just to let you know, the phone numbers in the UK usually start off with the area code such as: 02920 then the number 123456 so there shouldn't be any problem in setting up something the way you have shown. By the way, why didn't I think of "mobile telephone numbers are not acceptable"? Sometimes in life the easiest things are the most succesful!

Thanks again and kindest regards to you in the US
KB

When everything else is said and done, there will be nothing else to say or do
 
Hi noconi

Tried what you suggested and it works perfectly. Many thanks again for taking the time to reply

Take care
KB


When everything else is said and done, there will be nothing else to say or do
 
Fantastic! Glad that you got it working the way you need.

Tiffany
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top