473,809 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ 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=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>

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


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(it em) & "<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=tr ue
| else blnvalidname=fa lse 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
7231
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 some properties objUserInfo.UserName = txtUserName.text.trim objUserInfo...
1
2532
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 can maintain the state of a variable? Imagine the variable is a Class, not String. After clicking the submit button, I updated some properties in the instance of the class. How do I use the updated class instance after submitting the form?...
1
1383
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 following equal rows should be blanked in column one, se example: Col.one Col.two Col.three A Data1 DataA1 Data2 DataA2 Data3 DataA3 B Data1 DataB1
8
9209
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 by lnk2_Click(). The others return to their original values initiated during their declaration. But the static variable's life doesn't end when the page is closed and it causes
2
2728
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
2874
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 basic code (as shown below) which used a meta tag to refresh an aspx page every second. It tests whether there is any content in a session variable, if not then it writes a timestamp to a text file, recreates the data in the variable and continues....
5
4115
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. What I have in this new page is streamwriter which writes user's data to a log file. Now if I comment out the line that calls the write method of the streamwriter, the session variable is fine. Thanks in advance for any helps
13
3076
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 between the datatable and ObjectDataSources. In one page I had a Gridview with select enabled. When an row in the grid is selected, I retrieve the SelectedValue, store the value in a Session variable and redirect the response to another web page,...
0
920
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. Click refresh button on toolbar in page B. Error occurs because session variable has been lost. This occurs in VS 2005 dev environment (VS web server) or production server. The sessionState section of my web.config is as follows - <sessionState
4
1200
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 would global variable(static, or application variable) get lost too?? Thanks very much.
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10643
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10391
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.