Get ready for BLACK FRIDAY shopping starting in

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>
&lt;select name="Category"&gt;

&lt;%
While (NOT rsCategories.EOF)
%&gt;
&lt;option value="&lt;%=(rsCategories.Fields.Item("CategoryID".Value)%&gt;" &lt;% If rsCategories.Fields.Item("Category".Value = rsProduct.Fields.Item("Category".Value Then %&gt; Selected &lt;% End If %&gt;&gt;&lt;%=(rsCategories.Fields.Item("Category".Value)%&gt;&lt;/option&gt;
&lt;%
rsCategories.MoveNext()
Wend
If (rsCategories.CursorType &gt; 0) Then
rsCategories.MoveFirst
Else
rsCategories.Requery
End If
%&gt;

&lt;/select&gt;
</font id=code></pre id=code>

:: Son, im Thirty.... ::

Reply to this topic