I have this form which checks for values before it
process itself, all of the validation is working ok but
to check for the strName if empty nothing works with it!!
if i check for IsEmpty the blnValidName is always returns
empty
i tried it with if len(strname)>0 then blnvalidname=tr ue
else blnvalidname=fa lse but still didnt work out!
Thanx
---
<% @language="VBSC RIPT" %>
<% Option Explicit %>
<% response.buffer =true %>
<% 'Make sure page refreshed when hitting the back
button or openinig
Response.Expire s = 60
Response.Expire sabsolute = Now() - 1
Response.AddHea der "pragma","n o-cache"
Response.AddHea der "cache-control","priva te"
Response.CacheC ontrol = "no-cache"
%>
<%
Dim StrURL, StrName, StrComment, StrEmail
Dim blnValidName, blnValidComment , blnValidEmail
Dim blnFormOK
%>
<style>
body {
scrollbar-face-color: #40588C;
scrollbar-highlight-color: #40588C;
scrollbar-shadow-color:
#461717; scrollbar-3dlight-color: #FFD98F;
scrollbar-arrow-color: #FFD98F; scrollbar-
track-color: #40588C;
scrollbar-darkshadow-color: #FFD98F;}
</style>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta http-equiv="keywords "
content="web,ho st,hosting,site ,website,ecreat ions,custom
software,intern et programming">
<meta http-equiv="descript ion" content="Web design and
computer programming in winnipeg">
<title>Ecreatio nsCanada Contact us page</title>
<link rel="stylesheet " type="text/css" href="Css.css">
<script type="text/javascript" language="JavaS cript1.2"
src="_pgtres/stm31.js"></script>
</head>
<body TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0"
MARGINHEIGHT="0 ">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#1 11111"
width="100%" id="AutoNumber1 ">
<tr>
<td width="187" align="left" style="position :
absolute; top: 0; left:0" height="132">
<Img src="images/Logo.gif" height="110" align="top"
width="199">
</td>
</style>
<td width="100%" align="center" style="position :
absolute; top: 13; z-index:0; left:189">
<%
Dim yy
yy = DatePart("yyyy" ,Now())
%>
<script type="text/javascript" language="JavaS cript1.2"
src="ecreations .js"></script>
</td>
<td width="100%" align="right" style="position : absolute;
top: 13; z-index:0; left:600">
<font size="3" color="#FFFFFF" > <%=Application( "WhoOn")%>
Users Online Now</font></td>
</tr>
</table>
</center>
<div align="center">
<center>
<br>
<br>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" width="678"
id="AutoNumber2 ">
<tr>
<td width="508" height="21" align="center"
style="position : absolute; top: 55; z-index:0; left:130">
<p align="center"> <span style="text-transform:
capitalize"><b>
<font size="4">Contac t us</font></b></span></td>
<td width="169" align="right" style="position :
absolute; top: 33; left:590"><font size="3"
color="#FFFFFF" ><p><%= FormatDateTime( Date, 1) %
</P></td></font></td>
</tr>
</table>
</center>
</div>
<br><br><br><br >
<% Function ProcessForm()
strName=""
StrURL = trim(Request.fo rm("Contact_URL "))
StrEmail = trim(request.fo rm("Contact_Ema il"))
StrComment = Trim(Request.fo rm("Comment"))
StrName = Trim(request.fo rm("Contact_Nam e"))
'if ValFirstName(St rName) then blnValidName=tr ue else
blnValidName=fa lse
if strName="" then blnValidname=fa lse else
blnvalidname=tr ue
if NOT Isnumeric(StrNa me) then blnValidName = true else
blnValidName=fa lse
if len(StrComment) >0 then blnValidComment = true else
blnValidComment =false
If NOT validEmail (StrEmail) then blnValidEmail = false
else blnValidEmail = True
if CheckName (StrName) Then BlnValidName = true else
blnValidName = false
blnFormOK = (blnValidName and blnValidEmail and
blnValidComment )
if ucase(trim(requ est.ServerVaria bles("REQUEST_M ETHOD")))
="GET" then
blnValidName = true
blnValidEmail = true
blnValidComment = true
end if
If blnFormOK = true then
Call SendMail
else
ShowForm
End If
End Function %>
<% if ucase(trim(requ est.ServerVaria bles
("REQUEST_METHO D")))="GET" then
blnValidName = true
blnValidEmail = true
blnValidComment = true
ShowForm
elseif ucase(trim(requ est.ServerVaria bles
("REQUEST_METHO D")))="POST" then
Call processForm()
end if
%>
<% Function CheckName(byval StrNameChecked)
dim I ,blnNameChecked , Test
Dim WrongType (23)
wrongtype(0)="0 "
wrongtype(1)="1 "
wrongtype(2)="2 "
Wrongtype(3)="3 "
wrongtype(4)="4 "
Wrongtype(5)="5 "
Wrongtype(6)="6 "
Wrongtype(7)="7 "
Wrongtype(8)="8 "
Wrongtype(9)="9 "
Wrongtype(10)=" '"
Wrongtype(11)=" """
Wrongtype(12)="]"
Wrongtype(13)="["
Wrongtype(14)=" {"
Wrongtype(15)=" }"
Wrongtype(16)=" <"
Wrongtype(17)=" >"
Wrongtype(18)=" ?"
Wrongtype(19)=" ."
Wrongtype(20)=" ,"
Wrongtype(21)=" |"
Wrongtype(22)=" \"
Wrongtype(23)="/"
blnNameChecked = true
if len(StrNameChec ked)=0 then
For I = 0 to Ubound(WrongTyp e)
Test=instr(1,St rNameChecked,wr ongtype(i))
if test >0 then
blnNameChecked = false
end if
Next
end if
CheckName=blnNa meChecked
End Function
%>
<% Function ValidEmail(byva l StrEmail)
dim blnValid
blnValid = false
If not isEmpty(StrEmai l) then
if instr(StrEmail, "@") > 0 and instr
(StrEmail, ".") > 0 then
blnValid = true
end if
end if
ValidEmail = blnValid
End Function
%>
<% Function ShowForm()%>
<div align="center">
<center>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" width="85%"
id="AutoNumber3 ">
<tr>
<td width="100%" valign="top">
<p align="center"> <span style="font-style:
normal"><font size="3" color="#FFFFFF" >Your comments and
suggestions are important to us as we continue to improve
our product and services.
For quick answers and facts about
EcreationsCanad a.com, Please contact us by
either filling the form on this page or email us at
<a href="mailto:we *******@ecreati onscanada.com?
subject=Website contact form">
we*******@ecrea tionscanada.com</a>.</font></span></td>
</tr>
</table>
</center>
</div>
<br><br>
<div align="center" style="width: 472; height: 250">
<FORM METHOD="POST" ACTION="<%Respo nse.Write
request.ServerV ariables("SCRIP T_NAME")%>"
<p> Please provide the following contact information:</P>
<BLOCKQUOTE>
<TABLE>
<TR>
<TD ALIGN="right">
<% If not blnValidName then response.write "<font
color=""#FF0000 "">"%>
<EM>Name</EM></TD></font>
<TD>
<INPUT NAME="Contact_N ame" SIZE=35 value="<%
Response.write trim(StrName)%> ">
</TD>
</TR>
<TR>
<TD ALIGN="right">
<% If not blnvalidEmail then response.write "<font
color=""#FF0000 "">"%>
<EM>E-mail</EM></TD></font>
<TD>
<INPUT NAME="Contact_E mail" SIZE=35 value="<%
Response.write trim(StrEmail)% >">
</TD>
</TR>
<tr>
<TD ALIGN="right">
<EM>URL</EM></TD>
<TD>
<INPUT NAME="Contact_U RL" SIZE=35 MAXLENGTH=25 value="<%
response.write request.form("C ontact_URL")%>" >
</TD>
</tr></font>
<TR>
<TD ALIGN="right">
<% If not blnValidComment then response.write "<font
color=""#FF0000 "">"%>
<em>Comment</em></font></TD>
<TD>
<textarea rows="2" name="Comment" cols="29"><%
response.write trim(StrComment )%>
</textarea>
</TD>
</TR>
</TABLE>
</BLOCKQUOTE><p>
<INPUT TYPE=SUBMIT VALUE="Submit Form">
<INPUT TYPE=RESET VALUE="Reset Form"></P>
</FORM>
</div>
</table>
<% End Function %>
</BODY>
</HTML>