How can I get the dropdown's selected value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • London

    #16
    Re: How can I get the dropdown's selected value

    Thank you very much.
    but
    I wrote this code:

    <%@ Language=VBScri pt %>
    <%
    option explicit
    dim xy
    xy=Request.Quer ystring("select 1")
    %>
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" Content="text/html; charset=x-sjis">
    <META NAME="GENERATOR " Content="Micros oft Visual Studio 6.0">
    </HEAD>
    <BODY>
    <FORM id=form1 name=form1 action=ASPPage6 .asp method=get>
    <SELECT id=select1 name=select1>
    <OPTION value=1 selected>One</OPTION>
    <OPTION value=2>Two</OPTION>
    </SELECT>
    <P><INPUT id=submit1 type=submit value=Submit name=submit1></P>
    <P><INPUT id=text1 value="<%=xy%>" name=text1></P>
    </FORM>
    </BODY>
    </HTML>

    When I click the submit button,the page is error.Error message:
    "
    Page not found
    ....
    HTTP 404 - Files not found
    Internet Information Services
    ....
    "
    Can you more help me

    Comment

    • Bob Barrows

      #17
      Re: How can I get the dropdown's selected value

      Ummmm - replace "ASPPage6.a sp" with the actual name of the asp page???

      By the war, I very deliberately surrounded the attribute values (such as
      "ASPPage6.a sp") with quotes in the example I provided. I do not see quotes
      in your new code here.

      Bob Barrows

      ondon wrote:[color=blue]
      > Thank you very much.
      > but
      > I wrote this code:
      >
      > <%@ Language=VBScri pt %>
      > <%
      > option explicit
      > dim xy
      > xy=Request.Quer ystring("select 1")
      > %>
      > <HTML>
      > <HEAD>
      > <META HTTP-EQUIV="Content-Type" Content="text/html; charset=x-sjis">
      > <META NAME="GENERATOR " Content="Micros oft Visual Studio 6.0">
      > </HEAD>
      > <BODY>
      > <FORM id=form1 name=form1 action=ASPPage6 .asp method=get>
      > <SELECT id=select1 name=select1>
      > <OPTION value=1 selected>One</OPTION>
      > <OPTION value=2>Two</OPTION>
      > </SELECT>
      > <P><INPUT id=submit1 type=submit value=Submit name=submit1></P>
      > <P><INPUT id=text1 value="<%=xy%>" name=text1></P>
      > </FORM>
      > </BODY>
      > </HTML>
      >
      > When I click the submit button,the page is error.Error message:
      > "
      > Page not found
      > ...
      > HTTP 404 - Files not found
      > Internet Information Services
      > ...
      > "
      > Can you more help me[/color]



      Comment

      • SW

        #18
        Re: How can I get the dropdown's selected value

        I have a similar task to "London's" and am having trouble finding the
        easiest way to do it. I do have some asp experience but sometimes you
        have to do new things...

        I have built a form and have it submitting to the server fine. The
        problem I am having is that in many text boxes I need to be able to go
        "lookup" the value the user typed in and then populate another text
        box with an answer (from another table).

        Example:
        The user is typing in a mechanical problem description. One field is
        a "Part number" - when the user types that in and moves off that field
        I have to go to another table with that part number and lookup the
        "Descriptio n" of that part number, I then have to auto-fill that text
        box on the screen. I can do it with a Submit button but the customer
        wants this to happen automatically (!darn customers!) without having
        to click on anything.

        I have to use all VBScript because of customer requirements so I don't
        think the OnBlur() attribute is available to me.

        I thought I could put some VBScript lookup code in the 'value'
        attribute of the "part number" field?? But I can't find any
        examples of people doing this on any of these groups.

        Anyone have some ideas or know where some examples of this might be?

        Thanks for the help!

        Susan Williamson

        Comment

        • Guinness Mann

          #19
          Re: How can I get the dropdown's selected value

          In article <f95f42c8.03100 90842.41cdc99d@ posting.google. com>,
          Susan_Williamso n@amsec.com says...[color=blue]
          > The user is typing in a mechanical problem description. One field is
          > a "Part number" - when the user types that in and moves off that field
          > I have to go to another table with that part number and lookup the
          > "Descriptio n" of that part number, I then have to auto-fill that text
          > box on the screen. I can do it with a Submit button but the customer
          > wants this to happen automatically (!darn customers!) without having
          > to click on anything.[/color]

          Susan, I don't understand your problem well enough to answer your
          question, but I do have a couple of comments.

          First, this problem would be trivial in .NET. Perhaps that's not an
          option for you.

          Secondly, another group here at work has a sort of related situation.
          What they do is bring an entire table of data over to the client along
          with the form. Then as the user moves around on the form they use
          javascript to update various fields. Note that our application runs on
          an intranet, and we have complete control over browsers and settings.

          -- Rick

          Comment

          • janice li

            #20
            Re: How can I get the dropdown's selected value



            I need help to display the selected value from database in the dropdown
            list. Following is my code...but there are some error:

            while NOT rs.EOF
            Response.Write ("<option value = '" & rs("Description ") & "'")
            Response.Write (">")
            If rs("Description ") = rsStatus("sc_st atus") Then
            Response.Write ("<Option value = '" & rsStatus("sc_st atus") & "'
            SELECTED>")
            Else
            Response.Write (rs("Descriptio n"))
            Response.Write ("</option>")
            rsStatus.MoveNe xt
            end if
            wend

            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            • Devdex Developer

              #21
              Re: How can I get the dropdown's selected value



              You have to submit ur form under which your drop down element exist.
              After submitting you can get it's value like this
              to display
              Response.Write request("NameOf control")
              to assign to some variable
              ur variable request("NameOf control")

              Or you can even catch it with out submiting through java script.





              *** Sent via Developersdex http://www.developersdex.com ***
              Don't just participate in USENET...get rewarded for it!

              Comment

              • Devdex Developer

                #22
                Re: How can I get the dropdown's selected value


                Guinness Mann no body is perfect is this IT world.Can u think bill gates
                knows how to programme in Java . Absolutely not. So pls encourage other
                fellow developers.
                thanx
                peace


                *** Sent via Developersdex http://www.developersdex.com ***
                Don't just participate in USENET...get rewarded for it!

                Comment

                • Bob Barrows [MVP]

                  #23
                  Re: How can I get the dropdown's selected value

                  janice li wrote:[color=blue]
                  > I need help to display the selected value from database in the
                  > dropdown list. Following is my code...but there are some error:[/color]

                  We are not looking over your shoulder at your screen. You need to tell us
                  what the errors are.

                  --
                  Microsoft MVP -- ASP/ASP.NET
                  Please reply to the newsgroup. The email account listed in my From
                  header is my spam trap, so I don't check it very often. You will get a
                  quicker response by posting to the newsgroup.


                  Comment

                  • Thomas Dodds

                    #24
                    Re: How can I get the dropdown's selected value

                    while NOT rs.EOF
                    If rs("Description ") = rsStatus("sc_st atus") Then
                    strSelect = "SELECTED"
                    else
                    strSelect = ""
                    end if

                    Response.Write ("<option value = '" & rs("Description ") & "' " &
                    strSelect & ">")
                    Response.Write (rs("Descriptio n"))
                    Response.Write ("</option>")

                    rsStatus.MoveNe xt
                    wend



                    "janice li" <j_liinn@hotmai l.com> wrote in message
                    news:%23QQTlqAk EHA.2812@tk2msf tngp13.phx.gbl. ..[color=blue]
                    >
                    >
                    > I need help to display the selected value from database in the dropdown
                    > list. Following is my code...but there are some error:
                    >
                    > while NOT rs.EOF
                    > Response.Write ("<option value = '" & rs("Description ") & "'")
                    > Response.Write (">")
                    > If rs("Description ") = rsStatus("sc_st atus") Then
                    > Response.Write ("<Option value = '" & rsStatus("sc_st atus") & "'
                    > SELECTED>")
                    > Else
                    > Response.Write (rs("Descriptio n"))
                    > Response.Write ("</option>")
                    > rsStatus.MoveNe xt
                    > end if
                    > wend
                    >
                    > *** Sent via Developersdex http://www.developersdex.com ***
                    > Don't just participate in USENET...get rewarded for it![/color]


                    Comment

                    • janice li

                      #25
                      Re: How can I get the dropdown's selected value



                      Thanks a lot....

                      I got it already..

                      *** Sent via Developersdex http://www.developersdex.com ***
                      Don't just participate in USENET...get rewarded for it!

                      Comment

                      Working...