Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2005, 09:31 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default drop down box selected value

I have a drop-down menu:

Code:
<select name="clas" tabindex="6" STYLE="color: black; font: 8pt Verdana, Arial, Helvetica, sans-serif;">
                        <option value="1">First</option>
                        <option value="2">Business</option>
                        <option value="3">Economy</option>
                        <option value="4">Premium Economy</option>                                            
                    </select>
I have a asp variable with a value of either 1,2,3 or 4.

How to i set the SELECTED value as the one that matches the ASP variable value.

e.g.

Code:
theclass = request("class")
response.Write "the class = "&theclass&"<br>"
gives me 3. How do i make <option value="3">Economy</option> the selected value?

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old March 31st, 2005, 09:56 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

<select name="clas" class="input" tabindex="6" STYLE="color: black; font: 8pt Verdana, Arial, Helvetica, sans-serif;">
                    <% if theclasscode = "1" then %>
                        <option value="1" selected>First</option>
                        <option value="2">Business</option>
                        <option value="3">Economy</option>
                        <option value="4">Premium Economy</option>
                     <% end if %>
                    <% if theclasscode = "2" then %>
                        <option value="1">First</option>
                        <option value="2" selected>Business</option>
                        <option value="3">Economy</option>
                        <option value="4">Premium Economy</option>
                     <% end if %>
                    <% if theclasscode = "3" then %>
                        <option value="1">First</option>
                        <option value="2">Business</option>
                        <option value="3" selected>Economy</option>
                        <option value="4">Premium Economy</option>
                    <% end if %>
                    <% if theclasscode = "4" then %>
                        <option value="1">First</option>
                        <option value="2">Business</option>
                        <option value="3">Economy</option>
                        <option value="4" selected>Premium Economy</option>
                    <% end if %>
                    <% if theclasscode = "" then %>
                        <option value="1">First</option>
                        <option value="2">Business</option>
                        <option value="3" selected>Economy</option>
                        <option value="4">Premium Economy</option>
                    <% end if %>
                    </select>

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt





Similar Threads
Thread Thread Starter Forum Replies Last Post
combo box remain selected after submission RanjanD1 Classic ASP Professional 2 September 7th, 2007 07:56 AM
option selected from a select box Adam H-W Classic ASP Basics 3 December 11th, 2006 11:09 AM
run database query when drop-down is selected crmpicco Classic ASP Basics 4 August 9th, 2005 12:28 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.