-
Hi all, I'm trying to learn vbscript now that I understand vb.
I have 2 files, 1.html and 2.asp.
I have a textbox and a cmdbutton in 1.html. I want to type "abc" in the textbox, press the cmbutton, then it opens up 2.asp and displays "abc" there.
What I have done is, dim a variable TextTest in 1.html. Cmbutton_OnClick, I put in the value of the textbox into TextTest, and navigate "2.asp".
In the form field, I have
<form NAME="frmOpening" , action="2.asp">
NOw the big question is, how do I refer back to TextTest in 2.asp?? In vb I can just put set newVar = frmOpening.TextTest. But how do I do it in vbs since there are 2 different files?
I guess essentially my question is, how do I carry over a variable value to another page.
BTW, I am using Personal Web Server under Win95.
Thanks a lot.
Martin
-
Hi msuryadarma
ammend the form to
<form NAME="frmOpening" action="2.asp" method="POST">
replace the link with a submit button or you can use a link to submit the link
Either
<INPUT type="submit" value="Continue">
Or
<A href="javascript:document.frmOpening.submit();">continue</a>
and then in 2.asp
Put
Dim myvar
myvar = Request.Form("TextTest")
Hope this helps
Ian
-
Ian, thanks for the reply, but I got an error msg loading 2.asp.
It says Error: Object Required: 'Request'
Can you help me again? Thanks!!
Martin
-
You need to put the code for 2.asp in Server side script.
Enclose it in <% %> tags like this:
Code:
<%@ Language=VBScript %>
<%
Dim myvar
myvar = Request.Form("TextTest")
Response.Write myvar & "<BR>"
%>
.
.
.
-
Hmmmmmm
Monte, thanks for the reply.
Now that I use your example, the script doesn't run. Obviously there's no error msg either, but it just doesn't do anything.
Is this a problem with my personal web server? I put the files in the WWWROOT directory that's default for personal web server.
One other thing though, if I try running the html in frontpage editor preview, it runs fine. But if I try it in IE, when it navigates to 2.asp, it gives an error HTTP 501 Not Implemented. Any clue?
Martin
-
are you just clicking on 1.htm the file or are you accessing it through the server
becuase you need to run the asp through the server. go to ie and type in the address
http://localhost/1.htm
or
http://yourmachinename/1.htm
for it to work
Ian