Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Jump menus don't keep selected data

Status
Not open for further replies.

Jovix

Programmer
Dec 3, 2003
39
US
I'm trying to setup a search page, I have 3 database driven jump menus. my problem is that when I select from the list in the jump menus, the selection does not stay after the page reloads. the jump menu resets itself.

can anyone help please, I'm stuck on this one.
 
So you are using a jump menu to reload a page. You need to add a bit of code into your menu. Can you post the code for your menu.

Cheech

[Peace][Pipe]
 
<select name=&quot;lstSeries&quot; onChange=&quot;MM_jumpMenu('this',form,0)&quot;>
<option selected value=&quot;&quot;>Choose One</option>
<%
While (NOT rsSearchSeries.EOF)
%>
<option value=&quot;search.asp?Condition=<%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%>&quot;><%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%></option>
<%
rsSearchSeries.MoveNext()
Wend
If (rsSearchSeries.CursorType > 0) Then
rsSearchSeries.MoveFirst
Else
rsSearchSeries.Requery
End If
%>
</select>
 
In order for what you want to work, you need to mark the selected option as selected, like this:

Code:
<select name=&quot;lstSeries&quot; onChange=&quot;MM_jumpMenu('this',form,0)&quot;>
    <option value=&quot;&quot;>Choose One</option>
<%
    While (NOT rsSearchSeries.EOF)
        If (rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value = Rquest(&quot;lstSeries&quot;)) Then
            strSelected = &quot; selected&quot;
        Else
            strSelected = &quot;&quot;
        End If
%>
    <option value=&quot;search.asp?Condition=<%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%>&quot; <%= strSelected %>><%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%></option>
<%
        rsSearchSeries.MoveNext()
    Wend
    If (rsSearchSeries.CursorType > 0) Then
        rsSearchSeries.MoveFirst
    Else
        rsSearchSeries.Requery
    End If
%>

Hope that helps :)

Take Care,
Mike
 
Mike, thanks for the reply, I placed the code you gave me into my page. But I'm still having the same problem, the page reloads and the jump menu resets to the first option.

here is my current code. I appreciate you're help.
Jovix

<select name=&quot;fldSeries&quot; onChange=&quot;MM_jumpMenu('parent',this,0)&quot;>
<option value=&quot;&quot;>Choose One</option>
<%
While (NOT rsSearchSeries.EOF)
If (rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value = Request(&quot;fldSeries&quot;)) Then
strSelected = &quot; selected&quot;
Else
strSelected = &quot;&quot;
End If
%>
<option value=&quot;search2.asp?Condition=<%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%>&quot; <%= strSelected %>><%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%></option>
<%
rsSearchSeries.MoveNext()
Wend
If (rsSearchSeries.CursorType > 0) Then
rsSearchSeries.MoveFirst
Else
rsSearchSeries.Requery
End If
%>
 
Do you have this page publicly available? I'd like to take a look at it, if possible. Could you post the URL?

Take Care,
Mike
 
Where it says
Code:
<select name=&quot;fldSeries&quot; onChange=&quot;MM_jumpMenu('parent',this,0)&quot;>
change it to
Code:
<select name=&quot;fldSeries&quot; onChange=&quot;MM_jumpMenu('parent',this)&quot;>
.

See if that helps.

Take Care,
Mike
 
hi Mike,

Made the change and it didn't help.

Thanks,
J
 
Try this,
Code:
<select name=&quot;fldSeries&quot; onChange=&quot;MM_jumpMenu('parent',this,0)&quot;>
    <option value=&quot;&quot;>Choose One</option>
<%
    While (NOT rsSearchSeries.EOF)
        If (rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value = Request.Querystring(&quot;fldSeries&quot;)) Then
            strSelected = &quot; selected&quot;
        Else
            strSelected = &quot;&quot;
        End If
%>
    <option value=&quot;search2.asp?Condition=<%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%>&quot; <%= strSelected %>><%=(rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value)%></option>
<%
        rsSearchSeries.MoveNext()
    Wend
    If (rsSearchSeries.CursorType > 0) Then
        rsSearchSeries.MoveFirst
    Else
        rsSearchSeries.Requery
    End If
%>

Or try this
<select name=&quot;fldSeries&quot; onChange=&quot;MM_jumpMenu('parent',this,0)&quot;>
    <option value=&quot;&quot;>Choose One</option>
<%
    While (NOT rsSearchSeries.EOF)
        strPartType = rsSearchSeries.Fields.Item(&quot;PartType&quot;).Value
        reqPartType = Request.Querystring(&quot;Condition&quot;)
%>
    <option value=&quot;search2.asp?Condition=<%=strPartType%>&quot; <%If (strPartType = reqPartType) Then Response.Write&quot;selected&quot; End If%>><%=strPartType%></option>
<%
        rsSearchSeries.MoveNext()
    Wend
    If (rsSearchSeries.CursorType > 0) Then
        rsSearchSeries.MoveFirst
    Else
        rsSearchSeries.Requery
    End If
%>

Cheech

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top