Computing.Net > Forums > Web Development > drop down menu database link

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

drop down menu database link

Reply to Message Icon

Name: Daminda
Date: February 16, 2005 at 10:25:21 Pacific
OS: 2000
CPU/Ram: 1 G
Comment:

Hello,
I have a drop down menu with the 12 months. Below that is a list of names with a checkbox next to each. I want to be able to select the month and have the checkboxes populated with info from a MS Access database. The database has months as a primary key and all the names with true/false values for each.
Any ideas on how to do this with either ASP or Javascript?
Thanks.

DMR



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: February 16, 2005 at 18:22:18 Pacific
Reply:

Would help if you supplied more details. For instance are you buildng the checkboxes dynamiccaly throug the database? What are the values of the checkboxes? What is your level of expertise?

But, here is a general description of how it can be done.

In a javascript block create a nested array. Each sub array will be for each month of the year (0=January, 1=February, etc.) In each sub array enter the values of the checkboxes corresponding to each of the names for that month. Example:
---------------------
dateAry = new Array ();
dateAry[0] = new Array ('Mike','David');
dateAry[1] = new Array ('Ana','John');
dateAry[2] = new Array ('Chris','Joe');
dateAry[3] = new Array ('Ralph','JoJo');
Etc . . . down to 11 for Dec.
---------------------

Then also create a javascript function that will run onChange of the select list. Assuming that the select list is named month, here is what the function could look like:
----------------------
function changeMonth() {
var df = document.forms[0];
selMon = df.month.value;
for (i=0; i<12; i++){
   if (i==selMonth) {chkVal = true}
   else {chkVal = false}
   for (j=0; j<dateAry[i].length; j++) {
      df[dateAry[i][j]].checked = chkVal;
   }
}
----------------------

Michael J


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: drop down menu database link

Drop down Menu problem www.computing.net/answers/webdevel/drop-down-menu-problem/292.html

program for drop down menu www.computing.net/answers/webdevel/program-for-drop-down-menu/2442.html

Drop down menu www.computing.net/answers/webdevel/drop-down-menu/1213.html