Re-Selecting values in multi-select menu

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

    Re-Selecting values in multi-select menu


    I use a multi-select menu in an ASP so the user can pick several values.

    <select multiple name="lbErrorTy pe" size="12">

    However, after I have saved the records to the DB, and the user comes back
    to edit a prior record, I re-populate the multiple select box and do a
    "<option selected>" for each record that is saved to the DB.

    <option selected>

    But only the last value is selected !?!?

    How do I get the select menu to select ALL the appropriate values ?



  • Bob Lehmann

    #2
    Re: Re-Selecting values in multi-select menu

    How are you doing your "<option selected>" now !?!?

    Also, for my own edification, what does "lb" in lbErrorType stand for?

    Bob Lehmann

    "PW" <pwa@NObigSPAMp ond.net.au> wrote in message
    news:e9htBVukEH A.3428@TK2MSFTN GP14.phx.gbl...[color=blue]
    >
    > I use a multi-select menu in an ASP so the user can pick several values.
    >
    > <select multiple name="lbErrorTy pe" size="12">
    >
    > However, after I have saved the records to the DB, and the user comes back
    > to edit a prior record, I re-populate the multiple select box and do a
    > "<option selected>" for each record that is saved to the DB.
    >
    > <option selected>
    >
    > But only the last value is selected !?!?
    >
    > How do I get the select menu to select ALL the appropriate values ?
    >
    >
    >[/color]


    Comment

    • PW

      #3
      Re: Re-Selecting values in multi-select menu


      "Bob Lehmann" <nospam@dontbot herme.zzz> wrote in message
      news:urnfwvukEH A.1712@TK2MSFTN GP09.phx.gbl...[color=blue]
      > How are you doing your "<option selected>" now !?!?
      > Also, for my own edification, what does "lb" in lbErrorType stand for?[/color]


      the "lb" just stabds for "listbox", a term from other languages I have used
      in the past.

      Heres the code snippet I am working on ... (rs1 is another result set that
      is open and contains the matching error types to be selected)

      <%
      mySQL = "Select ErrorType from ErrorType order by ErrorType"
      rs2.open mySQL,myDSN
      %>
      <select multiple name="lbErrorTy pe" size="12">
      <%Do While Not rs2.EOF%>
      <%if rs1("ErrorType" ) = rs2("ErrorType" ) then%>
      <option selected>
      <%=rs2("ErrorTy pe")%>
      </option>
      <%rs1.MoveNext% >
      <%else%>
      <option>
      <%=rs2("ErrorTy pe")%>
      </option>
      <%end if%>
      <%rs2.MoveNext% >
      <%Loop%>
      </select>
      <%
      rs2.Close
      Set rs2 = Nothing
      %>




      Comment

      • PW

        #4
        Re: Re-Selecting values in multi-select menu


        Found it. It was table navigation logic. thanks anyways.



        Comment

        Working...