Forums

This topic is locked

Dynamic (dropdown) menus without Options from rs

Posted 26 May 2004 19:03:52
1
has voted
26 May 2004 19:03:52 Matt Adams posted:
I've been trying to figure this out for awhile.

I'm trying to have a dynamic menu (dropdown menu) pass data to a database, and between a series of add/view/edit pages, without using "Options from Recordset".

Basically, I have 4 Static list values (NULL-Please Select, Mr.-Mr., Ms.-Ms., Dr.-Dr.) that submit as text, into a table column set to char/varchar. I need this data to then be able to be picked up on the other pages, by simply picking up the entered value, and displaying it in the dropdown as the initial value (much like you would do with a text field).

I set the "Set Value equal to:" to point at the corresponding column in my recordset (again, like you would do with a text field) but it will simply not display the data. It will display it in almost any scenario, except a dropdown menu.. so I'm guessing it may just be a limitation of Dreamweaver.

Anyway, here's the code for the menu.. any help would be greatly appreciated.

<pre id=code><font face=courier size=2 id=code> &lt;select name="Title" id="Title" tabindex="1"&gt;
&lt;option value="" &lt;%If (Not isNull((rs_Contacts.Fields.Item("Title".Value))) Then If ("" = CStr((rs_Contacts.Fields.Item("Title".Value))) Then Response.Write("SELECTED" : Response.Write(""%&gt;&gt;Please Select&lt;/option&gt;
&lt;option value="Mr." &lt;%If (Not isNull((rs_Contacts.Fields.Item("Title".Value))) Then If ("Mr." = CStr((rs_Contacts.Fields.Item("Title".Value))) Then Response.Write("SELECTED" : Response.Write(""%&gt;&gt;Mr.&lt;/option&gt;
&lt;option value="Ms." &lt;%If (Not isNull((rs_Contacts.Fields.Item("Title".Value))) Then If ("Ms." = CStr((rs_Contacts.Fields.Item("Title".Value))) Then Response.Write("SELECTED" : Response.Write(""%&gt;&gt;Ms.&lt;/option&gt;
&lt;option value="Dr." &lt;%If (Not isNull((rs_Contacts.Fields.Item("Title".Value))) Then If ("Dr." = CStr((rs_Contacts.Fields.Item("Title".Value))) Then Response.Write("SELECTED" : Response.Write(""%&gt;&gt;Dr.&lt;/option&gt;
&lt;/select&gt;</font id=code></pre id=code>

Replies

Replied 26 May 2004 20:42:41
26 May 2004 20:42:41 Matt Adams replied:
Nevermind.. it turns out that the fields in the database need to be set to "varchar" instead of "char". My dropdowns now work as expected. yay.

Reply to this topic