CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2002
    Location
    New Orleans
    Posts
    23

    simple form submission problem

    I'm an ASP newbie, so please bear with me:

    Can anyone tell me why the message boxes are not displaying
    the values in the following:


    This is the form page:

    http://www.bytesizedsystems.com/aspfiles/default.asp

    which has a form action of director.asp.


    This is the code on the director.asp page:

    <%@ Language=VBScript %>
    <html>
    <head>
    <META name=VI60_defaultClientScript content=VBScript>

    <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

    </head>
    <body>



    <SCRIPT LANGUAGE=vbscript>
    <!--
    Dim radiovalue
    Dim username
    Dim usernumber

    radiovalue = "<%Request.Form.Item("radionewcheck")%>"
    username = "<%Request.Form.Item("textuserid")%>"
    usernumber = "<%Request.Form.Item("textphoneno")%>"

    MsgBox "Radio value is " + radiovalue
    MsgBox "User Name is " + username
    MsgBox "User Number is " + usernumber

    -->
    </SCRIPT>


    </body>
    </html>



    Thanks in advance.

  2. #2
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    I have not done a lot of ASP but you could try the following.

    radiovalue = "<%Request.Form.Item('radionewcheck')%>"
    username = "<%Request.Form.Item('textuserid')%>"
    usernumber = "<%Request.Form.Item('textphoneno')%>"

    Notice the use of single-quotes within the double-quotes. If you "View Source" of the director.asp page in the client browser, it has the following:

    radiovalue = ""
    username = ""
    usernumber = ""

  3. #3
    Join Date
    May 2001
    Posts
    3
    Hi.
    The problem with the code is that you missed the '=' sign when you wrote the "<%...%>" it should be "<%=...%>"
    for example:
    radiovalue = "<%=Request.Form.Item("radionewcheck")%>"

  4. #4
    Join Date
    Dec 2000
    Posts
    15
    Good catch. Going further <%=......%> is equivalent to
    <%Response.Write ..... %>

    Enjoy Asp...

  5. #5
    Join Date
    Nov 2001
    Location
    Ukraine (Odesa, Lviv)
    Posts
    74
    It's easy.
    You trying to show MessageBox on server side but not on client side.

    <SCRIPT runat=client language=vbscript>

    </script>

    default runat attribute is server.

    Have a good day

  6. #6
    Join Date
    Nov 2001
    Location
    Ukraine (Odesa, Lviv)
    Posts
    74

    Angry

    Oh, I have made mistake.

    default runat attribute set to client and you can't use Request object on client side

    Bye

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

Featured