#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0

    VBS variable to be posted to ASP page not working


    On the webpage, the VBS code saves the user LogOn name to variable User_Name. A button is then used to post the variable to another ASP page as a hidden field. The variable is not posted for some reason. All the solutions on the forum do not seem to work?

    VB Script:

    PHP Code:
    <script language "vbscript">
    Dim objNet
    dim User_Name
    Set objNet 
    CreateObject("WScript.NetWork"
    User_Name =  objNet.UserName
    Msgbox User_Name
    Set objNet 
    Nothing
    </script>
     
    ASP Script:

    PHP Code:
    <form action="sendfile_test.asp" method="POST" name="frmToday">
    <
    input type="submit" value="Download" style="float: left" name="btnToday">
    <
    input type="hidden" name="User_Name" value="<%=User_Name%>"></form
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    Everything you posted will rin in the web browser. Where is any server-side asp code?
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    2
    Rep Power
    0
    Hi Doug
    The idea is when somebody opens the page, their user login is captured in VBS variable User_Name. The msgbox displays the captured login correctly so this part works (used for testing purposes only). Now I need to pass this variable to another page as a hidden field. I have a form button that submits to another page but cannot transfer the VBS variable.
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,424
    Rep Power
    4539
    <script language = "vbscript">
    This line will cause the script to run in the browser, not on the server. Use
    Code:
    <script language = "vbscript" runat="server">
    to identify code that will run on the server.

    You should be getting an error message with the code snip you showed.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Posts
    23
    Rep Power
    0

    debug


    Originally Posted by elliotgr
    On the webpage, the VBS code saves the user LogOn name to variable User_Name. A button is then used to post the variable to another ASP page as a hidden field. The variable is not posted for some reason. All the solutions on the forum do not seem to work?

    VB Script:

    PHP Code:
    <script language "vbscript">
    Dim objNet
    dim User_Name
    Set objNet 
    CreateObject("WScript.NetWork"
    User_Name =  objNet.UserName
    Msgbox User_Name
    Set objNet 
    Nothing
    </script>
     
    ASP Script:

    PHP Code:
    <form action="sendfile_test.asp" method="POST" name="frmToday">
    <
    input type="submit" value="Download" style="float: left" name="btnToday">
    <
    input type="hidden" name="User_Name" value="<%=User_Name%>"></form

    if you unhide the the form info can you see the value you expect

    i am not sure how <%=x%> equals x i would have thought it was <%x%> is this the right way to access a script variable in the firstplace or should you be using dom

    bill stewart - here to talk

IMN logo majestic logo threadwatch logo seochat tools logo