|
-
Oct 2nd, 2000, 10:51 AM
#1
Thread Starter
Member
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
-
Oct 2nd, 2000, 11:03 AM
#2
Fanatic Member
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
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Oct 2nd, 2000, 11:35 AM
#3
Thread Starter
Member
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
-
Oct 2nd, 2000, 05:58 PM
#4
Frenzied Member
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>"
%>
.
.
.
oOOo--oOOo
__ /\/\onte96
oOOo--oOOo
Senior Programmer/Analyst
MCP
[email protected]
[email protected]
Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..
-
Oct 3rd, 2000, 08:54 AM
#5
Thread Starter
Member
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
-
Oct 3rd, 2000, 09:05 AM
#6
Fanatic Member
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
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|