Forums
This topic is locked
List Menu - Current First???
Posted 03 May 2002 17:44:58
1
has voted
03 May 2002 17:44:58 tommy Fullerton posted:
Can anyone help?I have a dynamic drop down list menu on an update page. Is there a way that my current selected field from the list can be shown first?
Many thanks
Tommy
Replies
Replied 03 May 2002 18:14:20
03 May 2002 18:14:20 Andrew Watson replied:
Do you mean that the update page does not show the list menu value that is actually in the database?
Its a bit crap of UD that when you set the value of a listmenu to the value in the database it doesnt work.
You actually need to put a wee if statment in the select tag.
Does your list menu content come from the databse??
heres an example of a dynamic list menu, looking up values in a categories table.
my update page updates records in a table products. to show the appropriate one my list menu code looks like this...
<pre id=code><font face=courier size=2 id=code>
<select name="Category">
<%
While (NOT rsCategories.EOF)
%>
<option value="<%=(rsCategories.Fields.Item("CategoryID".Value)%>" <% If rsCategories.Fields.Item("Category".Value = rsProduct.Fields.Item("Category".Value Then %> Selected <% End If %>><%=(rsCategories.Fields.Item("Category".Value)%></option>
<%
rsCategories.MoveNext()
Wend
If (rsCategories.CursorType > 0) Then
rsCategories.MoveFirst
Else
rsCategories.Requery
End If
%>
</select>
</font id=code></pre id=code>
:: Son, im Thirty.... ::
Its a bit crap of UD that when you set the value of a listmenu to the value in the database it doesnt work.
You actually need to put a wee if statment in the select tag.
Does your list menu content come from the databse??
heres an example of a dynamic list menu, looking up values in a categories table.
my update page updates records in a table products. to show the appropriate one my list menu code looks like this...
<pre id=code><font face=courier size=2 id=code>
<select name="Category">
<%
While (NOT rsCategories.EOF)
%>
<option value="<%=(rsCategories.Fields.Item("CategoryID".Value)%>" <% If rsCategories.Fields.Item("Category".Value = rsProduct.Fields.Item("Category".Value Then %> Selected <% End If %>><%=(rsCategories.Fields.Item("Category".Value)%></option>
<%
rsCategories.MoveNext()
Wend
If (rsCategories.CursorType > 0) Then
rsCategories.MoveFirst
Else
rsCategories.Requery
End If
%>
</select>
</font id=code></pre id=code>
:: Son, im Thirty.... ::