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(<%=sess ion("var1")%>, <%=session("var 2")%>)
It breaks.
<html>
<head>
<script language=vbscri pt>
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 4 7229
How about;
data1 = session("var1")
data2 = session("var2")
Call OpenDoc("data1" , "data2")
or
data1 = Request.Form("v ar1")
data2 = Request.Form("v ar2")
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****@colinst eadman.com> wrote in message
news:40******** *************** ***@posting.goo gle.com... 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(<%=sess ion("var1")%>, <%=session("var 2")%>)
It breaks.
<html> <head> <script language=vbscri pt> 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
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****@colinst eadman.com> wrote in message
news:40******** *************** ***@posting.goo gle.com... 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(<%=sess ion("var1")%>, <%=session("var 2")%>)
It breaks.
<html> <head> <script language=vbscri pt> Sub button_onclick( ) Call OpenDoc("data1" , "data2") End Sub
Colin Steadman wrote on 21 jan 2004 in
microsoft.publi c.inetserver.as p.general: However if I replace this:
Call OpenDoc("data1" , "data2")
With this:
Call OpenDoc(<%=sess ion("var1")%>, <%=session("var 2")%>)
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("<%=ses sion("var1")%>" , "<%=session("va r2")%>")
Always view-source your asp output, if such things go wrong.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
> 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("<%=ses sion("var1")%>" , "<%=session("va r2")%>")
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=vbscri pt>
Sub button_onclick( )
Call OpenDoc("<%=Ses sion("var1")%>" , "<%=Session("va r2")%>")
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_contribut ors)!
Colin This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 session variables , or an store an array in a
session variable, but what I wanna do is store it all in a class
so I can use property get and...
|
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 Netscape
(4.75), the Frameset Session variables are not defined when accessed
in the frames. Why and how to fix this ?
Take these for example. The only...
|
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
email from (possibly) three seperate forms.
the following code is the end of a routine which stashes data from the first
form
off to session...
|
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 on a button it refers to the include file, which I
believe is all client-side code as there are no server <% %> tags.
|
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 way to store session data.
1) use the (string)Session approach
Obviously bad for maintenance, readability etc.
2) have a typed MySession object...
| |
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 application that need to somehow
appear in a classic ASP session. The strings are too long for cookies or
URLs and I'd like to avoid using a database or...
|
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 anyone suggest a btter way of passing a session var into a vbscript
function?
<%@ Page language="c#" debug="true" ContentType="text/html"
|
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 all the session names
but when I include the session.contents it gives me the following
error:
|
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 transferred the information into a session
variable. However what I didn't know was that deleting/manipulating
information in an array using vbscript was...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |