Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Default selected in List/Menu from DB

LEGEND ,
Aug 20, 2006 Aug 20, 2006
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...


TOPICS
Server side applications
449
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2006 Aug 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...
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2006 Aug 21, 2006
LATEST
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...
>>
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines