473,473 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

First variable is lost??

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"><p><%= FormatDateTime(Date, 1) %
</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:we*******@ecreationscanada.com?
subject=Website contact form">

we*******@ecreationscanada.com</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>

Jul 19 '05 #1
2 1624
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

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
---
<% @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"><p><%= FormatDateTime(Date, 1) %
</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:we*******@ecreationscanada.com?
subject=Website contact form">

we*******@ecreationscanada.com</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>


Jul 19 '05 #2
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
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Billy Jacobs | last post by:
I am having a problem with my session variable being set to Null for no apparent reason. I am declaring it like the following when the user logs in. dim objUserInfo as new clsUserInfo 'Set...
1
by: Joseph Luner | last post by:
I am having problem postback, (code shown below) the variable "my_str" is lost after clicking the "submit" button. Isn't it suppose to display "changed" after posting back? Is there anyway I...
1
by: John Martin | last post by:
This should be an easy match, but I'm lost. I want to perform a kind of grouping of the data in a datagrid object, so that only the first occurrence of a value in column one is visible. The...
8
by: hb | last post by:
Hi, I need to declare a variable who's value can be preserve through the same ASP.Net page. I tried the following code, only the static variable s2 keeps its value=22 after lnk1_Click followed...
2
by: summer00 | last post by:
Hi everyone, I found that the value of a variable(string type for example) is lost after the aspx page postback. E.G: private void Page_Load(object sender, System.EventArgs e) {
4
by: Sarah Marriott | last post by:
Our website contains session variables that are used to validate if a user is logged in etc. We have found that these variables are randomly lost while navigating the website. We set up some...
5
by: Sam | last post by:
Hi All, I have a very weird issue with my session variable and I'm hoping that someone can help me out. The issue is my session variable dissappears after a request is redirected to a new page....
13
by: SAL | last post by:
Okay, don't bash me to hard for my design on this app, it's my first web app and it's in production. My basic design is using Datatables created via the designer with a business logic class in...
0
by: hdsllc | last post by:
I have an ASP.NET 2.0 app where I have the following scenario: 1. Set a session variable in page A. 2. From page A, click a link to navigate to page B (session variable needed in page B). 3....
4
by: lander | last post by:
If I create a page, then it's compiled upon first request, where can i find the compiled code? And another question, since aspnet_wp.exe is recycled sometimes, so session would get lost and...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.