Wrox Programmer Forums
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 24th, 2004, 08:42 PM
Authorized User
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default Phone Number validation help.

Just starting to really get into hand coded form validation.

I have this bit of code that does a fairly good job. I just want to make the phone number validation so that people can use a hyphen when they type a phone number. Can anyone show me how or help me with it.
<script language=vbscript>
Sub btnSubmit_OnClick()
    If isdate(honotice.txtlossdate.value) = 0 Then
        Alert "You must enter a loss date. If you do not know the loss date please call 1-800-000-0000"
        Exit Sub
    ElseIf  Len(honotice.txtinsuredname.value) <2 or IsNumeric(honotice.txtinsuredname.value)then
        Alert "You must enter the insured. If you do not know the insured name please call 1-800-000-0000"
        Exit Sub
    ElseIf Len(honotice.txtpolicynumber.value) = 0 Then
        Alert "You must enter the policy number. If you do not know the policy number please call 1-800-000-0000"
        Exit Sub    
    ElseIf isdate(honotice.txtpolicyeffectdate.value) = 0 Then
        Alert "You must enter a policy effective date. If you do not know the policy effective date please call 1-800-000-0000"
        Exit Sub
    ElseIf Len(honotice.txthomephone.value) <2 or Not IsNumeric(honotice.txthomephone.value) then
        Alert "You must enter a phone number. If you do not have a phone please call 1-800-000-0000"
        Exit Sub            
    End If
    Call honotice.submit()
End Sub
Since I'm asking I would also like to control the date range for the dates. Say it would only take a date before or after a specific date.


Old July 25th, 2004, 06:39 AM
Authorized User
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts

I posted this in this forum by mistake.
I would like to ask a moderator to remove it.
I've posted it in the VBscript forum and don't want to appear that I've posted it in 2 places intentionally.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation For Phone Number and Mobile Number dhruthi.ram99 Javascript How-To 12 October 30th, 2011 07:24 AM
Getting mobile phone number yukijocelyn C# 2005 0 May 28th, 2008 11:43 PM
phone number brackets dhoward VB.NET 2002/2003 Basics 1 November 8th, 2006 11:58 AM
phone number validation debjanib ASP.NET 1.0 and 1.1 Professional 0 June 6th, 2006 12:01 PM
reformat phone number netcrawler Classic ASP Databases 1 November 3rd, 2004 09:01 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.