Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 15th, 2004, 11:54 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Dependent List Box improvement

Hi,

(Please redirect me if this is not the appropriate forum).

Found a tutorial on the Macromedia website for
creating dynamic dependent list/combo boxes:

http://www.macromedia.com/support/dr...ic_listbox.htm

I would like to use it to search a database, however it seems to have one limitation.

I would be using it in the form of 3 combo boxes, i.e., grandparent, parent, child.

I need to be able to add static options to the combo boxes, but I'm not sure how to do this (or whether it is actually possible).

In other words, when someone selects an option from the grandparent box, it automatically loads all the relevant parent options from ny database. I would like to be able to make one of the parent options simply 'all', so that the user has the option of searching on all the parent options rather that being forced to search on one only. And then the same for the child box.

Can anyone point me in the right direction?

Thanks

SoC


Reply With Quote
  #2 (permalink)  
Old August 16th, 2004, 01:02 AM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Location: , , .
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Worked out how to do it.

Just need to add one line of code (bolded) to one of the functions:

Code:
function populateDynaList(oList, nIndex, aArray)

{

  oList.options[oList.options.length] = new Option("All","");

 for (var i = 0; i < aArray.length; i= i + 3){
 
 

  if (aArray[i] == nIndex){
   oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i + 2]);
  }
 }

 if (oList.options.length == 0){
  oList.options[oList.options.length] = new Option("[none available]",0);
 }
 
 oList.selectedIndex = 0;
}
SoC

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic selection of next page based on list box s gurupot JSP Basics 1 December 24th, 2007 06:03 AM
How to retain form values from dependent list ? George B Javascript 0 September 15th, 2006 03:54 PM
Dynamic List Box Post Back Problem rstelma ASP.NET 1.0 and 1.1 Professional 12 March 2nd, 2006 05:55 PM
Retain form value from dependent list box qhong Dreamweaver (all versions) 18 November 4th, 2004 03:36 AM
Two drop down dependent list boxes and a Button tcasp Classic ASP Basics 0 August 5th, 2003 02:06 PM



All times are GMT -4. The time now is 01:44 AM.


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