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

drop down menu database link

Reply to Message Icon

Original Message
Name: Daminda
Date: February 16, 2005 at 10:25:21 Pacific
Subject: drop down menu database link
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


Report Offensive Message For Removal


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

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


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: drop down menu database link

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 6 Days.
Discuss in The Lounge