p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: Response Redirect gives Object Required Error


Message #1 by "Ruth Long" <rlong@c...> on Mon, 25 Mar 2002 13:15:33
I have the following code to validate and format a date.  If the date is 
invalid it should reset the page but I am getting Error: Object 
Required 'Response' when I try to run it. The error occurs on the second 
instance of Response.Redirect("CumulativeReports.htm") and not on the 
first ("username.htm").

Any ideas would be greatly appreciated.

Ruth

<%
dim userlogged
Userlogged = session("MyUser")
Response.Buffer = True
if trim(userlogged) = "" then
	Response.Redirect("username.htm")
end if
%>
<SCRIPT LANGUAGE = vbscript>

function MediumDate (str)
Dim aDay
Dim aMonth
Dim aYear

	aDay = day(str)
	amonth = monthname(Month(str), true)
	aYear = year(str)
	MediumDate = aDay & " " & amonth & " " & ayear
end function

sub window_onload()
document.selreport.workdate.value = mediumdate(date()-1)
end sub

sub ViewRep_onclick()
if isdate(document.selreport.workdate.value) then
	document.selreport.WorkDate1.value = "'" & mediumdate
(document.selreport.workdate.value) & "'"
else
	Response.Redirect("CumulativeReports.htm")
end if
end sub

</SCRIPT>
Message #2 by "Bharat Saboo" <bharatsaboo@h...> on Mon, 25 Mar 2002 19:57:55 +0530
This is a multi-part message in MIME format.

------=_NextPart_000_0041_01C1D437.5AD84FE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

you cannot use the Response.Redirect inside the client side script.  you 
should use location.href=3D"cumulativeReports.htm" instead.

bharat

----- Original Message -----
From: Ruth Long
To: ASP components
Sent: Monday, March 25, 2002 1:15 PM
Subject: [asp_components] Response Redirect gives Object Required Error


I have the following code to validate and format a date.  If the date is
invalid it should reset the page but I am getting Error: Object
Required 'Response' when I try to run it. The error occurs on the second
instance of Response.Redirect("CumulativeReports.htm") and not on the
first ("username.htm").

Any ideas would be greatly appreciated.

Ruth

<%
dim userlogged
Userlogged =3D session("MyUser")
Response.Buffer =3D True
if trim(userlogged) =3D "" then
Response.Redirect("username.htm")
end if
%>
<SCRIPT LANGUAGE =3D vbscript>

function MediumDate (str)
Dim aDay
Dim aMonth
Dim aYear

aDay =3D day(str)
amonth =3D monthname(Month(str), true)
aYear =3D year(str)
MediumDate =3D aDay & " " & amonth & " " & ayear
end function

sub window_onload()
document.selreport.workdate.value =3D mediumdate(date()-1)
end sub

sub ViewRep_onclick()
if isdate(document.selreport.workdate.value) then
document.selreport.WorkDate1.value =3D "'" & mediumdate
(document.selreport.workdate.value) & "'"
else
Response.Redirect("CumulativeReports.htm")
end if
end sub

</SCRIPT>

bharatsaboo@h...
%%email.unsub%%




  Return to Index