Results 1 to 13 of 13

Thread: Drop Down menu

  1. #1
    Join Date
    Sep 2002
    Posts
    68

    Unanswered: Drop Down menu - PLEASE HELP ME

    1) I have created a web form with drop down menu's. After the web form is saved to an microsoft access database and you leave the page or even refresh the page it also resets the drop down menu. Is there a way to stop that?

    John316
    Last edited by John316; 11-02-02 at 01:00.

  2. #2
    Join Date
    Apr 2002
    Location
    England
    Posts
    21

    Re: Drop Down menu

    As far as I know you can't force the drop down menu open, although you can force it to be displayed as a list by defining a size greater than 1.

    e.g
    <select name="menu" size="2">

    this would make it a scrollable box where size defines the number of items shown before having to scroll.

    Dan

  3. #3
    Join Date
    Sep 2002
    Posts
    68

    Re: Drop Down menu

    Dan,

    I have now changed it to: <select name="menu" size="5" multiple> but still after the web form is saved to an microsoft access database and you leave the page or even refresh the page it still resets the drop down menu. Do you have any other idea's?

    John316



    Originally posted by pickledAvenger
    As far as I know you can't force the drop down menu open, although you can force it to be displayed as a list by defining a size greater than 1.

    e.g
    <select name="menu" size="2">

    this would make it a scrollable box where size defines the number of items shown before having to scroll.

    Dan

  4. #4
    Join Date
    Apr 2002
    Location
    England
    Posts
    21
    What is your page written in HTML or are you using server side scripting(ASP, PHP etc)?

  5. #5
    Join Date
    Sep 2002
    Posts
    68

    I wrote this in....

    I wrote this in .asp

    John316

    Originally posted by pickledAvenger
    What is your page written in HTML or are you using server side scripting(ASP, PHP etc)?

  6. #6
    Join Date
    Apr 2002
    Location
    England
    Posts
    21

    Re: I wrote this in....

    I'm asuming that you want the selected values to stay selected after the page has been submited.

    You will need to pass the entered form/info back to this page, either as a query string or a form.

    Use Response.Write to display your select box, this way you can control what will be written.

    So you will have somthing like:

    dim selected
    selected = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans1" then
    Response.Write (" selected")
    end if

    Response.Write (">ans1</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)

    This will make the selected option chosen after submit provided the form was posted to this page (if you have been redirected to this page after submitting to another you will need to pass this info on to the page with the drop down menu). This will only hold the info when the page is refreshed after the info has been submited once.

    Hope this is kind of what you're after

    Dan

  7. #7
    Join Date
    Sep 2002
    Posts
    68

    Re: I wrote this in....

    Dan,

    NO matter how I try your code it does not work, my code is below:

    <%
    dim Order
    Order = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans1" then
    Response.Write ("Order")
    end if

    Response.Write (">ans1</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)
    %>

    <%
    dim Order
    Order = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans2" then
    Response.Write ("Order")
    end if

    Response.Write (">ans2</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)
    %>

    <%
    dim Order
    Order = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans3" then
    Response.Write ("Order")
    end if

    Response.Write (">ans3</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)
    %>

    <%
    dim Order
    Order = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans4" then
    Response.Write ("Order")
    end if

    Response.Write (">ans4</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)
    %>


    John316

    Originally posted by pickledAvenger
    I'm asuming that you want the selected values to stay selected after the page has been submited.

    You will need to pass the entered form/info back to this page, either as a query string or a form.

    Use Response.Write to display your select box, this way you can control what will be written.

    So you will have somthing like:

    dim selected
    selected = Request("menu")

    Response.Write ("<select name=""menu"" size=""2"">" & VbCr & "<option")

    if selected = "ans1" then
    Response.Write (" selected")
    end if

    Response.Write (">ans1</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)

    This will make the selected option chosen after submit provided the form was posted to this page (if you have been redirected to this page after submitting to another you will need to pass this info on to the page with the drop down menu). This will only hold the info when the page is refreshed after the info has been submited once.

    Hope this is kind of what you're after

    Dan
    Last edited by John316; 10-28-02 at 14:52.

  8. #8
    Join Date
    Apr 2002
    Location
    England
    Posts
    21
    You have changed the name of the variable which you are loading the result into (= Request). This is fine, but you will also need to change the varaible name in the IF statement, so for your code all the if statements would need to read 'IF Order = "ans1" then' etc.

    If you want send me the pages and I'll take a look.

    Dan

  9. #9
    Join Date
    Sep 2002
    Posts
    68

    well pickledAvenger

    Dan,

    Below I am including my web page information. the only thing that ?I have so far is the drop down menu. I have 9 items in my drop down menu called DropdownItem1 - DropdownItem9. so here is my code:

    <form name="form1" method="post" action="update.asp">

    <select name=DropdownMenu etc size="4" multiple>
    <option value="DropdownItem1">DropdownItem1</option>
    <option value="DropdownItem2">DropdownItem2</option>
    <option value="DropdownItem3">DropdownItem3</option>
    <option value="DropdownItem4">DropdownItem4</option>
    <option value="DropdownItem5">DropdownItem5</option>
    <option value="DropdownItem6">DropdownItem6</option>
    <option value="DropdownItem7">DropdownItem7</option>
    <option value="DropdownItem8">DropdownItem8</option>
    <option value="DropdownItem9">DropdownItem9</option>
    </select>

    <%

    dim Order
    Order = Request("DropdownMenu")

    Response.Write ("<select name=""DropdownMenu"" size=""2"">" & VbCr & "<option")

    if Order = "DropdownItem1" then
    Response.Write ("Order")
    end if

    Response.Write (">DropdownItem1</option>" & VbCr)

    ' Do this for each option

    Response.Write ("</select>" & VbCr)
    %>

    </form>

    Thanks for all your help,
    John316


    Originally posted by pickledAvenger
    You have changed the name of the variable which you are loading the result into (= Request). This is fine, but you will also need to change the varaible name in the IF statement, so for your code all the if statements would need to read 'IF Order = "ans1" then' etc.

    If you want send me the pages and I'll take a look.

    Dan

  10. #10
    Join Date
    Apr 2002
    Location
    England
    Posts
    21
    Could you send us update.asp as well, we can then chack that the information is being returned correctly

  11. #11
    Join Date
    Sep 2002
    Posts
    68

    Dan

    Please past this file into an web editor and save as an .asp file

    John316

    Originally posted by pickledAvenger
    Could you send us update.asp as well, we can then chack that the information is being returned correctly
    Attached Files Attached Files

  12. #12
    Join Date
    Sep 2002
    Posts
    68

    PLEASE HELP ME

    Can Anyone help me?

    John316

  13. #13
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    <option Selectedvalue="25/11/2002">25/11/2002</option>
    you need a space between Selected and value


    rudy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •