Actually, I just wrote something very like this just to see if I could.  The goal in the exercise was to create dynamic lists that didn't require me to reload the page every time I needed an update.  The algorithm is entirely in javascript, and works basically like this:

You have two arrays, we'll call them "a" and "b".  "a" looks like this:

a[1] = "Color"
a[2] = "Size"
a[10] = "Red"
a[11] = "Green"
a[12] = "Blue"
a[20] = "Small"
a[21] = "Medium"
a[22] = "Large"

The numbering of "a" isn't significant...it's just how I like to keep them straight.  Array "b" looks like this:

b[1] = [10,11,12]
b[2] = [20,21,22]

The whole purpose of the "b" array is to show the relationship between the categories and the options...category 1 gets options 10, 11, 12, and so on.  You could, naturally, alter this to States/Counties.

In your form you have two empty select boxes, no options.  Pre-load the first one with the categories (or states, in your case), then as the user clicks on an item it's ID determines which element of "b" is used, which determines which elements of "a" are used to build the options for the second list.

You can find a demonstration (and the source code: View Source) at:

http://64.129.2.117/demo/demonstratelist.htm

Best regards,

Bill Morris
Independent Consultant
http://64.129.2.117/consulting

 

> >-----Original Message-----

> >From: Chris[[EMAIL PROTECTED]]
> >Date: Wednesday, May 16, 2001 11:17 AM
> >To: KCFusion-List[[EMAIL PROTECTED]]
> >Subject: [KCFusion] dynamic dropdowns
> >
> >
> >
> >We are working on a page that involves a state drop
> >down list and the counties in that state. We want to
> >make it dynamic so when a user chooses Missouri, just
> >the counties in Missouri are available.
> >
> >Here's what I got so far. On the onchange event for
> >the state drop down we are setting a variable called
> >favorite. If I declare an input whose name is
> >favorite you can see this getting changed each time a
> >new state is chosen. How do I go about setting up the
> >stored procedure to accept this variable as an
> >argument and reretrieve it each time the state is
> >changed?
> >
> >I've included my attempt at this but I'm not having
> >any luck.



Get your FREE download of MSN Explorer at http://explorer.msn.com

______________________________________________________________________ The KCFusion.org list and website is hosted by Humankind Systems, Inc. List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED] To Subscribe.................... mailto:[EMAIL PROTECTED] To Unsubscribe................ mailto:[EMAIL PROTECTED]

Reply via email to