Setting a Drop Down List Value

Results 1 to 2 of 2

Thread: Setting a Drop Down List Value

  1. #1
    Jacqui Guest

    Default Setting a Drop Down List Value

    How do I set the value in a drop down list based on a result returned from a query. ie I have a List with 01 to 31 representing the days of the month. I can work out todays day and so want to default the value to 07 rather than 01.<BR>Any help would be appreciated.

  2. #2
    Ben Timby Guest

    Default RE: Setting a Drop Down List Value

    Something like this:<BR><BR>lets say the possible values in your list box are in an array called aChoices, and the one you want highlighted by default is stored in RightChoice<BR><BR>&#060;select name=choices&#062;<BR>&#060;%<BR>For X = 0 To UBound(aChoices)<BR> If aChoices(X) = RightChoice Then<BR> Response.Write("&#060;option value=" 7 aChoices(X) & " selected&#062;" & aChoices(X))<BR> Else<BR> Response.Write("&#060;option value=" 7 aChoices(X) & "&#062;" & aChoices(X))<BR> End If<BR>Next<BR>%&#062;<BR>&#060;/select&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts