Skip to main content
Inspiring
August 20, 2006
Question

Default selected in List/Menu from DB

  • August 20, 2006
  • 2 replies
  • 449 views
DW 8.0.2
ASP/VBScript
MS SQL Server

I want to have my List/Menu in a form default to a value in DB. However, the
value in the DB needs to be compared with the ITEM LABEL not the VALUE in
the List/Menu.

When using the Dreamweaver Dynamic List/Menu hte only option seems to be to
compare it to the List?Menu value and not the label.

the form List/Menu is static and lists all 50 US State abbriviations as the
label and the state tax-rate as the values. The Database lists the state
abbriviation. I want the list to default to what the BD has (i.e. CA)

<option value="0">AK</option>
<option value="0">AL</option>
<option value=0.0825">CA</option>
etc...


This topic has been closed for replies.

2 replies

Inspiring
August 22, 2006
Thanks, Paul!
This is exactly what i wanted to do...I just didn't know how.

Armen

"Paul Whitham AdobeCommunityExpert" <design@valleybiz.net> wrote in message
news:ecdced$ldc$1@forums.macromedia.com...
> The DW compare statement is geared more around dropdowns that are brought
> in from database. If your is totally static then it is fairly easy
> (although a little laborius) to add the test.
>
> All you do is above the Select statement have a statements like this
>
> <% Dim ThisState
> ThisState = recordset.field.item("statefield").value
>
> Then you would code the following into each line of the <select>
>
> <option value="0" <% if ThisState = "AK" then Response.Write("Selected")
> End if %> >AK</option>
> <option value="0" <% if ThisState = "AL" then Response.Write("Selected")
> End if %>>AL</option>
> <option value=0.0825" <% if ThisState = "CA" then
> Response.Write("Selected") End if %>>CA</option>
>
> --
> Paul Whitham
> Certified Dreamweaver MX2004 Professional
> Adobe Community Expert - Dreamweaver
>
> Valleybiz Internet Design
> www.valleybiz.net
>
> "Armen" <mardirousi@sbcglobal.net> wrote in message
> news:ecas8o$g1s$1@forums.macromedia.com...
>> DW 8.0.2
>> ASP/VBScript
>> MS SQL Server
>>
>> I want to have my List/Menu in a form default to a value in DB. However,
>> the value in the DB needs to be compared with the ITEM LABEL not the
>> VALUE in the List/Menu.
>>
>> When using the Dreamweaver Dynamic List/Menu hte only option seems to be
>> to compare it to the List?Menu value and not the label.
>>
>> the form List/Menu is static and lists all 50 US State abbriviations as
>> the label and the state tax-rate as the values. The Database lists the
>> state abbriviation. I want the list to default to what the BD has (i.e.
>> CA)
>>
>> <option value="0">AK</option>
>> <option value="0">AL</option>
>> <option value=0.0825">CA</option>
>> etc...
>>
>
>


Inspiring
August 21, 2006
The DW compare statement is geared more around dropdowns that are brought in
from database. If your is totally static then it is fairly easy (although a
little laborius) to add the test.

All you do is above the Select statement have a statements like this

<% Dim ThisState
ThisState = recordset.field.item("statefield").value

Then you would code the following into each line of the <select>

<option value="0" <% if ThisState = "AK" then Response.Write("Selected") End
if %> >AK</option>
<option value="0" <% if ThisState = "AL" then Response.Write("Selected") End
if %>>AL</option>
<option value=0.0825" <% if ThisState = "CA" then Response.Write("Selected")
End if %>>CA</option>

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"Armen" <mardirousi@sbcglobal.net> wrote in message
news:ecas8o$g1s$1@forums.macromedia.com...
> DW 8.0.2
> ASP/VBScript
> MS SQL Server
>
> I want to have my List/Menu in a form default to a value in DB. However,
> the value in the DB needs to be compared with the ITEM LABEL not the VALUE
> in the List/Menu.
>
> When using the Dreamweaver Dynamic List/Menu hte only option seems to be
> to compare it to the List?Menu value and not the label.
>
> the form List/Menu is static and lists all 50 US State abbriviations as
> the label and the state tax-rate as the values. The Database lists the
> state abbriviation. I want the list to default to what the BD has (i.e.
> CA)
>
> <option value="0">AK</option>
> <option value="0">AL</option>
> <option value=0.0825">CA</option>
> etc...
>