How To - Pass the content of a variable on one page to another page 
Author Message
 How To - Pass the content of a variable on one page to another page

If I gather a value into a variable through a script on one page and then
navigate the user to a different page, how do I pass the value of the
variable to the navigated page script?
ie The user selects which game they want to play on the opening page, then I
navigate them to the page where Merlin comes out and explains the rules etc.
but this page needs to know which data file the user selected so I can open
the correct tabular data control.

--snip from index.html
Dim index
Public WordFile
Grade2.Recordset.MoveFirst
for index = 1 to Grade2.Recordset.RecordCount
ComboBox2.AddItem("week" & Grade2.Recordset.Fields(0).Value)
Grade2.Recordset.MoveNext
next
Sub G2_Click()
call ComboBox2.DropDown()
end sub
Sub ComboBox2_Click()
rem File2OPen = "./G2" & ComboBox2.Value & "/index.html"
File2OPen = "./index_merlin.html"
WordFile = "G2" & ComboBox2.Value & ".txt"
G2.Value = "True"
ComboBox3.Value = "Pick Week"
ComboBox4.Value = "Pick Week"
ComboBox5.Value = "Pick Week"
end sub
--end snip
--snip from Index_merlin.html
SUB StartGame_Click()
Merlin.MoveTo CenterX-160,CenterY+200
Merlin.Show
Merlin.Speak "So you've decided to take the test,"
Merlin.Speak "Without practicing first?"
Merlin.Play  "DoMagic1"
Merlin.Play  "DoMagicReturn"
Merlin.Play  "Hide"
window.navigate "./index_test.htm"
End Sub
--end snip
The value of WordFile set in index.html needs to be passed to index_test.htm
so it knows which data file to open.  I don't know how to do this.  Can you
give me some ideas?

Lee Rogowski



Wed, 28 Mar 2001 03:00:00 GMT  
 How To - Pass the content of a variable on one page to another page
I'm passing the QueryString like this in index.html.
WordFile = "G2" & ComboBox2.Value & ".txt"
File2OPen = "./index_merlin.asp?wordfile=" & WordFile
The url it sends is what I expect,
http://iis/spelltest/index_merlin.asp?wordfile=G2week27.txt

I'm able to access the QueryString value like this
<%
Response.Write(Request.QueryString("wordfile"))
%>

So I thought I'd be able to access the value in index_merlin.asp like;
<%
WordFile = Request.QueryString("wordfile")
%>
 but passing it to my ActiveX TDC doesn't seem to be working.

WordList.DATAUrl = WordFile

The value for WordFile doesn't seem to be passing to my Parameter
WordList.DATAUrl.
WordList is the Tabular DataControl.  Is the Active Server variable WordFile
different from the VBScript variable I've dimensioned?  If so, how do I get
the value of WordFile from my Request.QueryString to my TDC?

<!DOCTYPE HTML PUBLIC "-//W3C//DTDD HTML 3.2//EN">
<html>
<head>
<link REL="STYLESHEET" HREF="./common/spelltest.css" TYPE="text/css">
<title>Spelling Test Practice Game</title>
<!-- The Tabular Data Control -->
<OBJECT ID="Wordlist" WIDTH=0 HEIGHT=0 BORDER="0"
    CLASSID="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
    <PARAM NAME="UseHeader" VALUE="False">
    <PARAM NAME="FieldDelim" VALUE="~">
</OBJECT>
<body>
<center>
<object CLASSID="clsid:99B42120-6EC7-11CF-A6C7-00AA00A47DD2" ID="lbl1"
HEIGHT="190" WIDTH="350">
<param NAME="Angle" VALUE="0">
<param NAME="ForeColor" Value="#0000FF">
<param NAME="BackColor" Value="#000000">
<param NAME="Caption">
<param NAME="FontName" Value="Arial Black">
<param NAME="FontSize" Value="20">
<param NAME="Visible" Value="True">
</object>
</center>

<OBJECT ID="Agent" width=0 height=0
 CLASSID="CLSID:F5BE8BD2-7DE6-11D0-91FE-00C04FD701A5"

CODEBASE="http://activex.microsoft.com/controls/agent/msagent.exe#VERSION=1,
5,0,0">
</OBJECT>

<OBJECT ID="TruVoice" width=0 height=0
 CLASSID="CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575"

CODEBASE="http://activex.microsoft.com/controls/agent/cgram.exe#VERSION=1,5,
0,0">
</OBJECT>

<SCRIPT LANGUAGE = VBSCRIPT>
<!--
Option Explicit

Public WordFile
Dim Merlin
Dim LoadRequest(1)
Dim GetRequest(8)
Dim MerlinRequest
Dim DatapathType
Dim CenterX, CenterY
Dim TimerID
<%
WordFile = Request.QueryString("wordfile")
%>

WordList.DATAUrl = WordFile

Sub window_onload
On error resume next

 DatapathType = "UNC" ' set to UNC or URL depending on where character data
resides
 CenterX = 320
 CenterY = 240
 Agent.Connected = True ' May be needed in some contexts

  Wordlist.Recordset.MoveFirst
  lbl1.Caption = "Grade " & Wordlist.Recordset.Fields(0).Value & " - Week "
& Wordlist.Recordset.Fields(1).Value

  LoadMerlin

End Sub

Lee Rogowski


    The best way to acheive persistance is through Active Server Pages.

    If this is not an option, however, you could pass the variable as a
query string to the next page.

    window.navigate "./index_test.htm?" & ComboBox2.value

    Then, in index_test.htm, you can parse the value from location.search

    ----------------------------------
    John T. Spivey
    Purdue University Cytometry Labs - Bioscope Initiative



Wed, 28 Mar 2001 03:00:00 GMT  
 How To - Pass the content of a variable on one page to another page
This is what worked for me.

I passed the value in the QueryString from the game selection Page
(index.html) like this.
File2OPen = "./index_merlin.asp?wordfile=" & "G2" & ComboBox2.Value & ".txt"

The url it sends is what I expect,
http://iis/spelltest/index_merlin.asp?wordfile=G2week27.txt

In merlin_index.asp I did the Request before I opened the Tabular Data
Control
<title>Spelling Test Practice Game</title>
<% WordFile = Request.QueryString("wordfile") %>
<!-- The Tabular Data Control -->
<OBJECT ID="Wordlist" WIDTH=0 HEIGHT=0 BORDER="0"
    CLASSID="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
    <PARAM NAME="UseHeader" VALUE="False">
    <PARAM NAME="FieldDelim" VALUE="~">
    <PARAM NAME="DATAUrl" VALUE="<% =WordFile %>">
</OBJECT>
<body>

And it works Great!

Thanks to everyone for helping me.

Lee Rogowski



Thu, 29 Mar 2001 03:00:00 GMT  
 How To - Pass the content of a variable on one page to another page

Quote:

>If I gather a value into a variable through a script on one page and then
>navigate the user to a different page, how do I pass the value of the
>variable to the navigated page script?

You cannot do this in standard VBScript. Try using ASP and passing a
querystring in the URL. You could also use a Session variable, also an ASP
thing. If ASP is not an option, you will have to use an ActiveX control to
store the value and pass it to another page. I can't think of any other ways
to do this right now. Perhaps someone else can... Good luck.

______________________________________
Tommy Higdon - Compaq Computer Corporation
NOTE: Opinions expressed are my own and
not necessarily those of Compaq.



Sat, 31 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Passing variables from one web page to another web page using JavaScript

2. Passing variables from web page contents to VB6

3. Passing string variables from one page to another

4. Post data from one page to another (BOA page) vb.net

5. pass a form from web page to web page

6. Need help passing SQL Statement to Next and Previous pages for Recordset Paging

7. Error 800A0BB9 when trying to pass the Sql statement from page to page

8. pass a form from web page to web page

9. Passing vairable values from page to page with VBScript

10. Loading page content into a jscript variable

11. Load rempte html page content into js variable??

12. passing variable argument list from web page to web service (is it possible)

 

 
Powered by phpBB® Forum Software