1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

ASP/HTML form - OnChange problem

Discussion in 'C#' 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. rb3m

    rb3m Peon

    Messages:
    192
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Perhaps it's sensing a change and going back to the default position indicated in the <select> statement?
    If that's the case maybe it can be corrected by including a selected=selected property in the <option> statement that the user clicked.
     
    rb3m, Oct 27, 2006 IP
  3. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi,

    don't quite follow. If it's after the postback that you want the option to stay selected, then in your loop you'll have to check the value of each entry, and when you find the one matching location put "SELECTED" on the end of the value tag.

    regards
     
    Free Born John, Oct 28, 2006 IP