Either expose the Session variable client side,
else if (document.frmUser.Project_Name.Value != "<%= Session
("UserProjectType") %>"
Or try remotescripting:
http://msdn.microsoft.com/scripting/default.htm?/scripting/remotescripting/d
efault.htm
Doug
-----Original Message-----
From: Ahmed Barradah [mailto:havana200@h...]
Sent: Wednesday, April 18, 2001 9:41 AM
To: javascript
Subject: [javascript] Calling a Session object in ASP from JavaScript
Function
Hi
I'm trying to check one of the text fields form that has a value equal
to a Session object in ASP...and I'm trying to do this through a
JavaScript function..but it is not working for some reason. Here is my
code:
<!--Declaring the HTML Version and setting up the font and background of
the page -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--Including a connection file -->
<!--#include file="Chap 15DB.inc"-->
<HTML>
<HEAD><TITLE>Delete Report Page</TITLE></HEAD>
<script language="JavaScript">
<!--
function VerifyName()
{
var Project;
Project = document.frmUser.Project_Name.Value;
if (document.frmUser.Project_Name.value == "")
{
alert ("Please enter the project name");
return false;
}
else if (document.frmUser.Project_Name.Value != Session
("UserProjectType"))
{
alert ("Please do not change this field!!!");
return false;
}
else if (document.frmUser.Problem_Report_Number.value == "")
{
alert ("Please enter the problem report number");
return false;
}
else
{
return true;
}
}
//-->
</Script>
<BODY BACKGROUND ="marbel1.JPG"
LINK="0000FF" VLINK="660066">
<CENTER><H2><BR>Delete a Current Problem Report </H2></CENTER>
<FORM ACTION="DeleteReport.asp" NAME="frmUser" METHOD="POST"
onSubmit="return VerifyName()">
<TABLE BORDER =0 align=center>
<%
if Session("Account_Type") = "SysAdmin" Then
%>
<TR>
<TD>Project Name:</TD>
<TD><INPUT TYPE="Text" NAME="Project_Name" SIZE="25"></TD>
</TR>
<TR>
<TD>Problem Report Number:</TD>
<TD><INPUT TYPE="Text" NAME="Problem_Report_Number" SIZE="25"></TD>
</TR>
<TD>
</TD>
<TD align=center><INPUT TYPE="Submit" VALUE="Delete
Report"> <INPUT TYPE="RESET"></TD>
</TR>
</TABLE>
</FORM>
<HR width=50% size="5">
<CENTER><A HREF="ProblemReportManagementUtilities.asp"> Return to the
previous page.</A></CENTER>
<% Else %>
<TR>
<TD>Project Name:</TD>
<TD><INPUT TYPE="Text" NAME="Project_Name" VALUE ="<%
Response.Write (Session("UserProjectType"))%>" size="25"></TD>
</TR>
<TR>
<TD>Problem Report Number:</TD>
<TD><INPUT TYPE="Text" NAME="Problem_Report_Number" SIZE="25"></TD>
</TR>
<TD>
</TD>
<TD align=center><INPUT TYPE="Submit" VALUE="Delete
Report"> <INPUT TYPE="RESET"></TD>
</TR>
</TABLE>
</FORM>
<HR width=50% size="5">
<CENTER><A HREF="ProblemReportList.asp"> Return to the previous
page.</A></CENTER>
</BODY>
</HTML>
<% End if %>
I'm using 2 sessions: one to check if the Account Type for the user is
SysAdmin and if it is not it will skip to the second Project Name and
input the value of the UserProjectType Session. Now my problem is how can
I prevent the user from changing that field in case of they are not a
SysAdmin. One way that I tried was to check the field through JScript as
shown above but didn't work. Another question...Do the event of
onmouseover work on NN 4.0? Because I tried it and it didn't work.
I would appreciate any help or suggestions from anyone. Thank you