Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

Re: FN-FORUM vbscript

date posted 23rd January 2003 17:34

It is a bit long but here it is - Thanks Pam



Function valid_form()
Response.write("bbb")
Dim Name_Error_msg
Dim Address_error_msg
Dim Address1_error_msg
Dim Town_error_msg
Dim County_error_msg
Dim Postcode_error_msg
Dim HomeTel_error_msg
Dim Email_error_msg
Dim Comment_error_msg
Dim Error_msgs
Error_msgs = 0

if Not validnamecontents(Request.Form("Name") Then
Name_Error_msg = "Please complete a valid Name"
Error_msgs = Error_msgs + 1
End if

if Not validaddresscontents(Request.Form("Address") Then
Address_error_msg = "Please complete a valid Address"
Error_msgs = Error_msgs + 1
End if

if Not validaddress2contents(Request.Form("Address1") Then
alert("a")
Address1_error_msg = "Please complete a valid Address or leave blank"
Error_msgs = Error_msgs + 1
End if

if Not validaddresscontents(Request.Form("Town") Then
Town_error_msg = "Please complete a valid Town"
Error_msgs = Error_msgs + 1
End if

if Not validaddress2contents(Requst.Form("County") Then
County_error_msg = "Please complete a valid County")
Error_msgs = Error_msgs + 1
End if

if Not validpostcodecontents(Request.Form("Postcode")
Postcode_error_msg = "Please complete a valid Postcode"
Error_msgs = Error_msgs + 1
End if

if Not validtelephonecontents(Request.Form("HomeTel")
HomeTel_error_msg = "Please complete your contact telephone number"
Error_msgs = Error_msgs + 1
End if

//CHECK EMAIL ADDRESS IF NOT BLANK (inputbox)

Dim inputbox = Request.form("Email")
if Len(inputbox)!= 0 Then

// Convert inputbox to string

Dim teststring

teststring = CStr(inputbox)

// Check for at least 7 chrs

if Len(teststring) dotpositionback Then
Email_error_msg = "The email address you have entered is not a valid
format"
Error_msgs = Error_msgs + 1
End if

End if

if Not validcommentscontents(Request.Forms("Comments")) Then
Comment_error_msg = "Please complete a valid comments/enquiries field"
Error_msgs = Error_msgs + 1
End if

if Error_msgs > 0 Then
valid_form = False
Else
valid_form = True
End if

End Function

Function validcommentscontents(inputbox)
Dim teststring
teststring = CStr(inputbox)
teststring = Trim(teststring)
if teststring = "" Then
validcommentscontents = False
Exit Function
End if
if IsNumeric(teststring) Then
validcommentscontents = False
Exit Function
End if
validcommentscontents = True
End Function

Function validnamecontents(inputbox)
Dim teststring
teststring = CStr(inputbox)
teststring = Trim(teststring)
if teststring = "" Then
validnamecontents = False
Exit Function
End if
if IsNumeric(teststring) Then
validnamecontents = False
Exit Function
End if
if Len(inputbox) < 2 Then
validnamecontents = False
Exit Function
End if
validnamecontents = True
End Function

Function checkvalidaddresscontents(inputbox)
Dim teststring
teststring = CStr(inputbox)
teststring = Trim(teststring)
if teststring = "" Then
checkvalidaddresscontents = False
Exit Function
End if
if IsNumeric(teststring) Then
checkvalidaddresscontents = False
Exit Function
End if
checkvalidaddresscontents = True
End Function

Function validaddress2contents(inputbox)
Dim teststring
teststring = CStr(inputbox)
teststring = Trim(teststrimg)
if teststring = "" Then
checkvalidaddresscontents = True
Exit Function
End if
if IsNumeric(teststring) Then
checkvalidaddresscontents = False
Exit Function
End if
checkvalidaddresscontents = True
End Function

Function validpostcodecontents(inputbox)
Dim teststring
teststring = CStr(inputbox)
teststring = Trim(teststring)
if testString = "" Then
validpostcodecontents = True
Exit Function
End if
if IsNumeric(teststring) Then
validpostcodecontents = False
Exit Function
End if
if (Len(teststring) < 2 Or Len(teststring.length) > 8) {
validpostcodecontents = False
Exit Function
}
validpostcodecontents = True
End Function

Function validtelephonecontents(inputbox)
var teststring
teststring = CStr(inputbox)
if Trim(teststring) = "" Then
validtelephonecontents = True
Exit Function
End if
Dim count = 0
While count < Len(inputbox)
Dim c = Mid(inputbox, count, 1)
if ((c Not = " ") And (c Not = "-") And Not IsNumeric(c)) Then
validtelephonecontents = False
Exit Function
}
count = count + 1
Wend
return 0
End Function



'

NTMail K12 - the Mail Server for Education



Messages by Day
January 31st 2003
January 30th 2003
January 29th 2003
January 28th 2003
January 27th 2003
January 26th 2003
January 25th 2003
January 24th 2003
January 23rd 2003
January 22nd 2003
January 21st 2003
January 20th 2003
January 19th 2003
January 18th 2003
January 17th 2003
January 16th 2003
January 15th 2003
January 14th 2003
January 13th 2003
January 12th 2003
January 11th 2003
January 10th 2003
January 9th 2003
January 8th 2003
January 7th 2003
January 6th 2003
January 5th 2003
January 4th 2003
January 3rd 2003
January 2nd 2003
January 1st 2003


Messages by Month
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000