473,394 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Dynamic default value a menu box troubles

I am trying to fill out a form from a record set and have a few menu
boxes that have a static list of values. I want to fill out the
default value with the variable from the recordset. The one solution i
thought of is as follows:

<td colspan="3"><select name="WorkshopType"
id="WorkshopType">

<% if WorkshopType = "Information Session" then
%>
<option value="Information Session" selected>Information Session</
option>
<option value="Interview Practice Clinic">Interview
Practice Clinic</option>
<option value="Senior Job Search Seminar">Senior Job
Search Seminar</option>
<% elseif WorkshopType = "Interview Practice Clinic" then
%>
<option value="Information Session">Information Session</option>
<option value="Interview Practice Clinic"
selected>Interview Practice Clinic</option>
<option value="Senior Job Search Seminar">Senior Job
Search Seminar</option>
<% elseif WorkshopType = "Senior Job Search Seminar" then
%>
<option value="Information Session">Information Session</option>
<option value="Interview Practice Clinic">Interview
Practice Clinic</option>
<option value="Senior Job Search Seminar"
selected>Senior Job Search Seminar</option>
<%end if%>

</select>

This works great. However, this menu only had 3 options so it was easy
to implement. I also have menus with 31 different options. The way i
came up with was to do something like this:

<select name="WorkshopMonth" id="WorkshopMonth">
<option Value = "<%response.Write(WorkshopMonth)%>" selected><
%response.Write(WorkshopMonth)%></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
</select>

Yes, this works, but it lists the default value twice. This isn't the
end of the world but I would like to clean it up a bit. Is there a
better way to do this?

May 14 '07 #1
1 2162
Nevermind, I guess the easiest way for me to do it is by doing it like
this:

<td width="103">Month
<select name="WorkshopMonth" id="WorkshopMonth">
<option value="1" <%if WorkshopMonth = 1 then
response.Write(" selected")%>>1</option>
<option value="2" <%if WorkshopMonth = 2 then
response.Write(" selected")%>>2</option>
<option value="3" <%if WorkshopMonth = 3 then
response.Write(" selected")%>>3</option>
<option value="4" <%if WorkshopMonth = 4 then
response.Write(" selected")%>>4</option>
<option value="5" <%if WorkshopMonth = 5 then
response.Write(" selected")%>>5</option>
<option value="6" <%if WorkshopMonth = 6 then
response.Write(" selected")%>>6</option>
<option value="7" <%if WorkshopMonth = 7 then
response.Write(" selected")%>>7</option>
<option value="8" <%if WorkshopMonth = 8 then
response.Write(" selected")%>>8</option>
<option value="9" <%if WorkshopMonth = 9 then
response.Write(" selected")%>>9</option>
<option value="10" <%if WorkshopMonth = 10 then
response.Write(" selected")%>>10</option>
<option value="11" <%if WorkshopMonth = 11 then
response.Write(" selected")%>>11</option>
<option value="12" <%if WorkshopMonth = 12 then
response.Write(" selected")%>>12</option>
</select>

May 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: pnr | last post by:
I am makeing a system where every user have there ovn menu, they can chose between about 20 different sides they want in there menu. Eache side contains that menu, the user logs in with username...
7
by: zorhel | last post by:
Hi. I will do a dynamic menu for a asp.net app.. I don't know yet if how I will get the data for populate this menu: from a sql server database, xml file or what, but I know it will be dynamic any...
1
by: biela | last post by:
Hi I'm from Poland and I have small question :). I'm looking for sample example how to create dynamic menu. Generaly my website will see like that ------------------------------------ 2...
1
by: tribal boy | last post by:
Guys, I am using a dynamic menu which uses xml,xsl a css file and javascript. This works fine when there are no server controls around or underneath it. The problem is whenever the menu...
19
by: mart2006 | last post by:
I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu....
0
by: =?Utf-8?B?QmlzaG95?= | last post by:
Hi All, I have a Right to Left web page with asp.net 2.0 containing a horizontal menu. The menu is right to left as the page. The problem is the submenu items or the dynamic menu items are...
10
by: mart2006 | last post by:
Hi, I'm fairly new to PHP and I've created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters...
4
by: SAL | last post by:
Hello, is there a way to menu control dynamically center itself horizontally on a page? I have placed a menu control in a panel control (no ajax) and would like it to center itself. Depending on...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.