onChange form problem

Discussion in 'JavaScript' started by missyp, Oct 27, 2006.

  1. #1
    I have the following code in a form:


    <% i=0
    rs_alt_tags.movefirst %>

    <select name="categories" class="formC" onChange="location=(this.options[this.selectedIndex].value);">

    <option value="%">Please select job category</option>
    while not rs_alt_tags.EOF%>
    <option value="index_andrew.asp?job_type=<%=i+1%>"
    <%=rs_alt_tags("jobcategory_name")%></option>


    <% rs_alt_tags.movenext
    i=i+1
    wend %>

    </select>


    It works perfectly fine, except when you select one of the dropdowns/options, it doesn't STAY on that particular selection.

    Anybody know how to do that?

    Thanks!
     
    missyp, Oct 27, 2006 IP
  2. Morishani

    Morishani Peon

    Messages:
    239
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    you have to use if statement,
    If you want the option to stay you have to write in it selected="selected" and then it will be the choosen one.
    if (i=request("job_type")) then response.write "selected=""selected"""
    PHP:
    (I Think)
     
    Morishani, Oct 27, 2006 IP
  3. missyp

    missyp Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply!

    How would I implement your line of code into my code?
     
    missyp, Oct 27, 2006 IP