View Single Post
  #3 (permalink)  
Old July 25th, 2004, 10:23 AM
mar0364 mar0364 is offline
Authorized User
 
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks allot!!

I'm going to open my wrox "VBScript reference" book and read about "regular expressions". Well I read chapter seven, four times and starting to understand the logic and objects.It is the implimentation I'm having trouble with. I googled regular expresions and test but could not come up with a good example (HIT ME WITH SHOVEL).

I tried to use your suggestion but I am obviously not doing it correctly. I do apprciate your help. Once I get this down I'm good to go.
Code:
<% 
dim objregx
set objregx
objregx.pattern = "(1-)?\d{3,}-\d{3,}-\d{4,}"

%>


<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"
        honotice.txtlossdate.focus
        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"
        honotice.txtinsuredname.focus
        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"
        honotice.txtpolicynumber.focus
        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"
        honotice.txtpolicyeffectdate.focus
        Exit Sub
    if (objRegx.test(honotice.txthomephone.value)) then
        Alert "You must enter a phone number. If you do not have a phone please call 1-800-000-0000"
        honotice.txthomephone.focus
        Exit Sub            
    End If
    Call honotice.submit()
End Sub
</script>

Thanks!
Rich
Reply With Quote