There comes a time when you'll need to develop a "Client-Side Dynamic Dependent List Box." What does this mean? In short... selecting one item in the "parent" list box will change the list in the "child" list box.
» Download available at bottom of page.
Building upon the excellent tech note at Macromedia (the developers of Dreamweaver), I have easily created a client-side dynamic dependent list box. For more information on what I'm actually talking about here, I'd recommend you review the tech note at the link I just provided.
After some help from Mick White, we made some minor modifications to the Macromedia code which adds a "Please Select" item at the top of each Child List menu which is highlighted as well. Having it highlighted is key in our validation; the validation script can now recognize that the first item is selected and will not allow the user to proceed unless they make another selection.
Finally, I added a slight modification which will display a message to the user if no items in the Child List Menu are available, i.e., "No SubCategories are Available" - go ahead and try the List Menus below; at least one of them should have no items available.
All of the asp/vbscript I used is the same found at the Macromedia Tech Note I mentioned before; I modified one function, which can be found at the bottom of this page. Look under the hood to view the outputted code.
I've included some sample code for you to download if you like. The zip file includes:
All You need to do is unzip the files into a common folder and run the .asp page on an IIS server.
All of the code and examples presented in my playground are either modifications of open source code or original works of Kindler Chase DBA Roubaix Interactive or a combination of both and are Copyright protected unless noted otherwise. You may not use the code here without asking first. OK, so I know you're not going to ask, so how about a nice thank you for playing gift?
This page last updated on 10/24/2007