First variable is lost??

S

Sammy

Hi Guys
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=true
else blnvalidname=false but still didnt work out!
Thanx
---
<% @language="VBSCRIPT" %>
<% Option Explicit %>
<% response.buffer=true %>
<% 'Make sure page refreshed when hitting the back
button or openinig
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "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,host,hosting,site,website,ecreations,custom
software,internet programming">
<meta http-equiv="description" content="Web design and
computer programming in winnipeg">
<title>EcreationsCanada Contact us page</title>

<link rel="stylesheet" type="text/css" href="Css.css">
<script type="text/javascript" language="JavaScript1.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="#111111"
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="JavaScript1.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">Contact us</font></b></span></td>
<td width="169" align="right" style="position:
absolute; top: 33; left:590"><font size="3"
color="#FFFFFF"> said:
</P></td></font></td>
</tr>
</table>
</center>
</div>
<br><br><br><br>
<% Function ProcessForm()
strName=""
StrURL = trim(Request.form("Contact_URL"))
StrEmail = trim(request.form("Contact_Email"))
StrComment = Trim(Request.form("Comment"))
StrName = Trim(request.form("Contact_Name"))
'if ValFirstName(StrName) then blnValidName=true else
blnValidName=false
if strName="" then blnValidname=false else
blnvalidname=true
if NOT Isnumeric(StrName) then blnValidName = true else
blnValidName=false

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(request.ServerVariables("REQUEST_METHOD")))
="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(request.ServerVariables
("REQUEST_METHOD")))="GET" then
blnValidName = true
blnValidEmail = true
blnValidComment = true

ShowForm


elseif ucase(trim(request.ServerVariables
("REQUEST_METHOD")))="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(StrNameChecked)=0 then
For I = 0 to Ubound(WrongType)
Test=instr(1,StrNameChecked,wrongtype(i))
if test >0 then
blnNameChecked = false
end if
Next
end if


CheckName=blnNameChecked

End Function
%>
<% Function ValidEmail(byval StrEmail)
dim blnValid
blnValid = false
If not isEmpty(StrEmail) 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
EcreationsCanada.com, Please contact us by
either filling the form on this page or email us at
<a href="mailto:[email protected]?
subject=Website contact form">

(e-mail address removed)</a>.</font></span></td>
</tr>
</table>
</center>
</div>
<br><br>
<div align="center" style="width: 472; height: 250">
<FORM METHOD="POST" ACTION="<%Response.Write
request.ServerVariables("SCRIPT_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_Name" 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_Email" SIZE=35 value="<%
Response.write trim(StrEmail)%>">
</TD>
</TR>
<tr>
<TD ALIGN="right">
<EM>URL</EM></TD>
<TD>
<INPUT NAME="Contact_URL" SIZE=35 MAXLENGTH=25 value="<%
response.write request.form("Contact_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>
 
B

Bob Barrows

Can you snip out the relevant section of the code so we don't have to go
digging through all this irrelevant html and code to find it?

Bob
Hi Guys
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=true
else blnvalidname=false but still didnt work out!
Thanx
---
<% @language="VBSCRIPT" %>
<% Option Explicit %>
<% response.buffer=true %>
<% 'Make sure page refreshed when hitting the back
button or openinig
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "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,host,hosting,site,website,ecreations,custom
software,internet programming">
<meta http-equiv="description" content="Web design and
computer programming in winnipeg">
<title>EcreationsCanada Contact us page</title>

<link rel="stylesheet" type="text/css" href="Css.css">
<script type="text/javascript" language="JavaScript1.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="#111111"
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="JavaScript1.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">Contact us</font></b></span></td>
<td width="169" align="right" style="position:
absolute; top: 33; left:590"><font size="3"
color="#FFFFFF"> said:
</P></td></font></td>
</tr>
</table>
</center>
</div>
<br><br><br><br>
<% Function ProcessForm()
strName=""
StrURL = trim(Request.form("Contact_URL"))
StrEmail = trim(request.form("Contact_Email"))
StrComment = Trim(Request.form("Comment"))
StrName = Trim(request.form("Contact_Name"))
'if ValFirstName(StrName) then blnValidName=true else
blnValidName=false
if strName="" then blnValidname=false else
blnvalidname=true
if NOT Isnumeric(StrName) then blnValidName = true else
blnValidName=false

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(request.ServerVariables("REQUEST_METHOD")))
="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(request.ServerVariables
("REQUEST_METHOD")))="GET" then
blnValidName = true
blnValidEmail = true
blnValidComment = true

ShowForm


elseif ucase(trim(request.ServerVariables
("REQUEST_METHOD")))="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(StrNameChecked)=0 then
For I = 0 to Ubound(WrongType)
Test=instr(1,StrNameChecked,wrongtype(i))
if test >0 then
blnNameChecked = false
end if
Next
end if


CheckName=blnNameChecked

End Function
%>
<% Function ValidEmail(byval StrEmail)
dim blnValid
blnValid = false
If not isEmpty(StrEmail) 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
EcreationsCanada.com, Please contact us by
either filling the form on this page or email us at
<a href="mailto:[email protected]?
subject=Website contact form">

(e-mail address removed)</a>.</font></span></td>
</tr>
</table>
</center>
</div>
<br><br>
<div align="center" style="width: 472; height: 250">
<FORM METHOD="POST" ACTION="<%Response.Write
request.ServerVariables("SCRIPT_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_Name" 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_Email" SIZE=35 value="<%
Response.write trim(StrEmail)%>">
</TD>
</TR>
<tr>
<TD ALIGN="right">
<EM>URL</EM></TD>
<TD>
<INPUT NAME="Contact_URL" SIZE=35 MAXLENGTH=25 value="<%
response.write request.form("Contact_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>
 
M

Max Payne

Iterate through the collection to find what you've got after a post. At
the same page, something like this:

For Each item In Request.Form
Response.Write item & " = " & Request.Form(item) & "<br>" & vbCrLf
Next

?


Sammy wrote:

| Hi Guys
| 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=true
| else blnvalidname=false but still didnt work out!
| Thanx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top