codefinger
May 26th, 2002, 08:31 AM
Objective: If the cookie exists for the username, fill in the user id name
on the form on default.asp. Store the user name as a cookie when the form is submitted.
This sounds so simple, but I have not been able to accomplish it. I used to
think I was reasonably smart. Now I think I must be one card short of a full deck.
Here is the code for default.asp (minus a few style instructions):
<%@ Language=VBScript %>
<%Option Explicit%>
<html>
<head>
<meta name="VI60_defaultClientScript" content="VBScript">
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>Information Services Application Respose System</title>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub window_onload
frmAR.textuserid.innerText = "<%=Request.Cookies("userinfo")("userid")%>"
End Sub
-->
</SCRIPT>
</head>
<body bgColor="lightskyblue">
<p><font color="mediumblue"></font> </p>
<p><font color="mediumblue" size="4">Welcome
to the Information Services Application Response
System (ISARS for short). This system provides an easy way of requesting and
at
the same time documenting user requests to Information Services.</font></p>
<p><font color="blueviolet"><font color="blue">
<form id="frmAR" name="frmAR" action=director.asp method=post
><strong>Please
Enter:</strong>
</font></font></p>
<p><font color="blueviolet"><font color="blue"><strong>Your network
User ID:
</strong>
<input id="textuserid" name="textuserid"></font></font></p>
<P><font color="#0000ff"><strong>Your
phone number</strong> :
<input id="textphoneno" name="textphoneno"></font></P>
<P><FONT color=#0000ff></FONT> </P>
<p align=left><font color="#0000ff"><STRONG>What do you want to
do?</STRONG></font></p>
<P align=left><STRONG><FONT color=#0000ff><INPUT id=radionewcheck type=radio
CHECKED
name=radionewcheck title="" value=newrequest.asp> Open a new
request</FONT></STRONG></P>
<P align=left><INPUT id=radionewcheck type=radio name=radionewcheck
value=existingrequest.asp> <FONT
color=blue><STRONG>Check the status of an existing
request.</STRONG></FONT></P>
<P align=center><FONT color=blue></FONT> </P><font
color="blueviolet"><font color="blue">
</font></font>
<p align=center>
<input id="submit1" type="submit" value="Submit" name="submit1"></p>
</FORM>
</body>
</html>
----------------------------------------------------------------------------
-----------
This is the code on the director.asp page, which either does not load or
can't redirect once frmAr is submitted:
<%@ Language=VBScript%>
<%Response.Buffer = true%>
<%
Response.Cookies("userinfo").expires = date + 10
Response.Cookies("userinfo")("username") =
Request.Form.Item("textuserid")
%>
<html>
<head>
<META name=VI60_defaultClientScript content=VBScript>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<body>
This is the director page...
<SCRIPT LANGUAGE=vbscript >
<!--
Dim radiovalue
Dim username
Dim usernumber
Dim passedstring
radiovalue = "<%=Request.Form.Item("radionewcheck")%>"
username = "<%=Request.Form.Item("textuserid")%>"
usernumber = "<%=Request.Form.Item("textphoneno")%>"
<% Response.Cookies(userinfo)("username") = username
Response.Redirect(Request.Form.Item("radionewcheck"))%>
-->
</SCRIPT>
</body>
</html>
If someone can tell me what I am doing wrong here, I would be eternally grateful. I have a huge web-based application in mind, but if I can't even write, read, and use a simple cookie, I am going to get very discouraged very early.
(I do seem to have an unfortunate tendency to make invalid combinations of server and client code, but I don't see where I am doing that here.)
Thanks in advance.
on the form on default.asp. Store the user name as a cookie when the form is submitted.
This sounds so simple, but I have not been able to accomplish it. I used to
think I was reasonably smart. Now I think I must be one card short of a full deck.
Here is the code for default.asp (minus a few style instructions):
<%@ Language=VBScript %>
<%Option Explicit%>
<html>
<head>
<meta name="VI60_defaultClientScript" content="VBScript">
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>Information Services Application Respose System</title>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub window_onload
frmAR.textuserid.innerText = "<%=Request.Cookies("userinfo")("userid")%>"
End Sub
-->
</SCRIPT>
</head>
<body bgColor="lightskyblue">
<p><font color="mediumblue"></font> </p>
<p><font color="mediumblue" size="4">Welcome
to the Information Services Application Response
System (ISARS for short). This system provides an easy way of requesting and
at
the same time documenting user requests to Information Services.</font></p>
<p><font color="blueviolet"><font color="blue">
<form id="frmAR" name="frmAR" action=director.asp method=post
><strong>Please
Enter:</strong>
</font></font></p>
<p><font color="blueviolet"><font color="blue"><strong>Your network
User ID:
</strong>
<input id="textuserid" name="textuserid"></font></font></p>
<P><font color="#0000ff"><strong>Your
phone number</strong> :
<input id="textphoneno" name="textphoneno"></font></P>
<P><FONT color=#0000ff></FONT> </P>
<p align=left><font color="#0000ff"><STRONG>What do you want to
do?</STRONG></font></p>
<P align=left><STRONG><FONT color=#0000ff><INPUT id=radionewcheck type=radio
CHECKED
name=radionewcheck title="" value=newrequest.asp> Open a new
request</FONT></STRONG></P>
<P align=left><INPUT id=radionewcheck type=radio name=radionewcheck
value=existingrequest.asp> <FONT
color=blue><STRONG>Check the status of an existing
request.</STRONG></FONT></P>
<P align=center><FONT color=blue></FONT> </P><font
color="blueviolet"><font color="blue">
</font></font>
<p align=center>
<input id="submit1" type="submit" value="Submit" name="submit1"></p>
</FORM>
</body>
</html>
----------------------------------------------------------------------------
-----------
This is the code on the director.asp page, which either does not load or
can't redirect once frmAr is submitted:
<%@ Language=VBScript%>
<%Response.Buffer = true%>
<%
Response.Cookies("userinfo").expires = date + 10
Response.Cookies("userinfo")("username") =
Request.Form.Item("textuserid")
%>
<html>
<head>
<META name=VI60_defaultClientScript content=VBScript>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</head>
<body>
This is the director page...
<SCRIPT LANGUAGE=vbscript >
<!--
Dim radiovalue
Dim username
Dim usernumber
Dim passedstring
radiovalue = "<%=Request.Form.Item("radionewcheck")%>"
username = "<%=Request.Form.Item("textuserid")%>"
usernumber = "<%=Request.Form.Item("textphoneno")%>"
<% Response.Cookies(userinfo)("username") = username
Response.Redirect(Request.Form.Item("radionewcheck"))%>
-->
</SCRIPT>
</body>
</html>
If someone can tell me what I am doing wrong here, I would be eternally grateful. I have a huge web-based application in mind, but if I can't even write, read, and use a simple cookie, I am going to get very discouraged very early.
(I do seem to have an unfortunate tendency to make invalid combinations of server and client code, but I don't see where I am doing that here.)
Thanks in advance.