473,395 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Putting Session Data In A VBScript

I'm trying to create a VBScript using ASP. However I'm having
problems getting data from session variables into the right places.
The example I have copied below works, however I need to replace
"data1" and "data2" with real data from a session variable.

However if I replace this:

Call OpenDoc("data1", "data2")

With this:

Call OpenDoc(<%=session("var1")%>, <%=session("var2")%>)

It breaks.
<html>
<head>
<script language=vbscript>
Sub button_onclick()
Call OpenDoc("data1", "data2")
End Sub

Sub OpenDoc(v1, v2)
msgbox v1
msgbox v2
End Sub
</script>
</head>
<body>
<input type=button name=button value="Click">
</body>
</html>

Any ideas?

TIA,

Colin
Jul 19 '05 #1
4 7213
How about;

data1 = session("var1")
data2 = session("var2")

Call OpenDoc("data1", "data2")

or

data1 = Request.Form("var1")
data2 = Request.Form("var2")

Call OpenDoc("data1", "data2")
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Colin Steadman <go****@colinsteadman.com> wrote in message
news:40**************************@posting.google.c om...
I'm trying to create a VBScript using ASP. However I'm having
problems getting data from session variables into the right places.
The example I have copied below works, however I need to replace
"data1" and "data2" with real data from a session variable.

However if I replace this:

Call OpenDoc("data1", "data2")

With this:

Call OpenDoc(<%=session("var1")%>, <%=session("var2")%>)

It breaks.
<html>
<head>
<script language=vbscript>
Sub button_onclick()
Call OpenDoc("data1", "data2")
End Sub

Sub OpenDoc(v1, v2)
msgbox v1
msgbox v2
End Sub
</script>
</head>
<body>
<input type=button name=button value="Click">
</body>
</html>

Any ideas?

TIA,

Colin

Jul 19 '05 #2
What "breaks" about it? What shows up in a view-source, as this is a client
side routine you're calling. Are the argument you're passing in there? Are
they string values that need to be in quotes, but are instead being
interpreted as variables, perhaps?

Ray at work
"Colin Steadman" <go****@colinsteadman.com> wrote in message
news:40**************************@posting.google.c om...
I'm trying to create a VBScript using ASP. However I'm having
problems getting data from session variables into the right places.
The example I have copied below works, however I need to replace
"data1" and "data2" with real data from a session variable.

However if I replace this:

Call OpenDoc("data1", "data2")

With this:

Call OpenDoc(<%=session("var1")%>, <%=session("var2")%>)

It breaks.
<html>
<head>
<script language=vbscript>
Sub button_onclick()
Call OpenDoc("data1", "data2")
End Sub

Jul 19 '05 #3
Colin Steadman wrote on 21 jan 2004 in
microsoft.public.inetserver.asp.general:
However if I replace this:

Call OpenDoc("data1", "data2")

With this:

Call OpenDoc(<%=session("var1")%>, <%=session("var2")%>)

It breaks.


And it should.
You put strings without "" as parameters for a clientside function call

You will end up with nonsense like:

Call OpenDoc(this is not a string, because it is undelimited)

in stead of:

Call OpenDoc("this is a string", "delimited too")
Try this:

Call OpenDoc("<%=session("var1")%>", "<%=session("var2")%>")

Always view-source your asp output, if such things go wrong.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4
> And it should.
You put strings without "" as parameters for a clientside function call

You will end up with nonsense like:

Call OpenDoc(this is not a string, because it is undelimited)

in stead of:

Call OpenDoc("this is a string", "delimited too")
Try this:

Call OpenDoc("<%=session("var1")%>", "<%=session("var2")%>")

Always view-source your asp output, if such things go wrong.

Bingo!

That was exactly the problem. I made the change you suggested and its
now working as I had originally intended.

That said I've just discovered (by accident) that it worked the other
way too, but only if I passed it a number.
<html>
<head>
<script language=vbscript>
Sub button_onclick()
Call OpenDoc("<%=Session("var1")%>", "<%=Session("var2")%>")
End Sub

Sub OpenDoc(v1, v2)
msgbox v1
msgbox v2
End Sub
</script>
</head>
<body>
<input type=button name=button value="Click">
</body>
</html>
Thanks for tipping me off (+ other_contributors)!

Colin
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: | last post by:
Hi, I want to do things this way: I have a bunch of stuff that I want to keep track of while a user is connected to the site. Maybe 50 little peices of information. So I know I can make 50...
4
by: A Web Master | last post by:
I am designing a site for a client where I have a frameset and 3 frames (all in ASP). I am creating session variables in the frameset that need to be accessed in the frames. It seams that in...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
2
by: Eric | last post by:
Hi, I've a problem with trying to retrieve a session variable in an include file. Basically, the main asp creates a session variable: <% Session("var1") = "Hello" %> And then when I click...
2
by: adam | last post by:
Having spent nearly 2 years in win forms land the inevitable request came for me to "do some web pages". So being new to this bit of .net and having had a look around I can't see where the best...
4
by: Chris Newby | last post by:
My project currently requires that I integrate an ASP.NET application with an ASP application. One of the issues I'm having is that I have some very long strings being created in an ASP.NET...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
11
by: Jerry | last post by:
I'm using this code: Dim strName For Each strName in Session.Contents Response.Write strName & " - " & Session.Contents(strName) & "<BR>" Next If I only do a response.write strName, it shows...
3
by: sjsean | last post by:
All thanks in advance for reading my post. I am new to using js and more accustomed to vbscript. I had written code which created a shopping cart into an array using vbscript and then...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.