Discussion:
session variables unavailable in javascript?
(too old to reply)
Joe Befumo
2006-02-18 19:54:21 UTC
Permalink
I'm unable to access my session variables in a javascript function. Here
are the details:

In global.asa, I have the following:

Sub Session_OnStart
Session("TestMessage") = "Test One Two hree."
End Sub

I can set a break on the session("Test Message") line and confirm that it's
firing.

In my asp page, I have the following:

<script language="javascript">

function checkFields(theForm)
{
alert("TestMessage");
return false;
}

</script>

This is called by:

<FORM action="subscribe.asp" method=post id=form1 name=form1
onSubmit="return checkFields(this)">

First of all, I can't set any breaks on the javascript routine.

That aside, when configured as above, it works as expected, that is, I get
an alert message saying "TestMessage", so I know that the function is being
called. Since the function returns a value of false, subscribe.asp is not
loaded.

However, if I change that alert as follows:

alert(Session("TestMessage"));

The javascript function is apparently never called - I do not get the alert
message, and subscribe.asp is loaded.

Any ideas?






--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
G. Whiz
2006-02-21 15:08:10 UTC
Permalink
Alert('<%=Session("TestMessage")%>')
Post by Joe Befumo
I'm unable to access my session variables in a javascript function. Here
Sub Session_OnStart
Session("TestMessage") = "Test One Two hree."
End Sub
I can set a break on the session("Test Message") line and confirm that
it's firing.
<script language="javascript">
function checkFields(theForm)
{
alert("TestMessage");
return false;
}
</script>
<FORM action="subscribe.asp" method=post id=form1 name=form1
onSubmit="return checkFields(this)">
First of all, I can't set any breaks on the javascript routine.
That aside, when configured as above, it works as expected, that is, I get
an alert message saying "TestMessage", so I know that the function is being
called. Since the function returns a value of false, subscribe.asp is not
loaded.
alert(Session("TestMessage"));
The javascript function is apparently never called - I do not get the
alert message, and subscribe.asp is loaded.
Any ideas?
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Joe Befumo
2006-03-04 15:39:19 UTC
Permalink
Yeah -- I realized shortly after I posted this that I was mixing client- and
server-side -- been in management too long.

Joe
Post by G. Whiz
Alert('<%=Session("TestMessage")%>')
Post by Joe Befumo
I'm unable to access my session variables in a javascript function. Here
Sub Session_OnStart
Session("TestMessage") = "Test One Two hree."
End Sub
I can set a break on the session("Test Message") line and confirm that
it's firing.
<script language="javascript">
function checkFields(theForm)
{
alert("TestMessage");
return false;
}
</script>
<FORM action="subscribe.asp" method=post id=form1 name=form1
onSubmit="return checkFields(this)">
First of all, I can't set any breaks on the javascript routine.
That aside, when configured as above, it works as expected, that is, I
get an alert message saying "TestMessage", so I know that the function is
being
called. Since the function returns a value of false, subscribe.asp is not
loaded.
alert(Session("TestMessage"));
The javascript function is apparently never called - I do not get the
alert message, and subscribe.asp is loaded.
Any ideas?
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
Loading...