Results 1 to 6 of 6

Thread: VBScript and ASP: Newbie Question

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48

    Question

    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

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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!

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48
    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

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    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..

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2000
    Posts
    48

    Unhappy 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

  6. #6
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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
  •  



Click Here to Expand Forum to Full Width