Wrox Programmer Forums
| 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 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
  #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


  #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



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





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