views:

38

answers:

1

i want to make a two drop down lists. the first list has static data( folder structure), so i can use an array for it,and depending on the folder or option selected in the first list, the second list shows the sub-folders in it. but the sub-folders keeps on changing, so i have to use asp fso for it. i am using the following fso code:
<%@ Language=VBScript ENABLESESSIONSTATE = False%>

<%

Dim fso, folder, files

Set fso=Server.CreateObject("Scripting.FileSystemObject")

Set folder=fso.GetFolder("D:\")

Set files=folder.SubFolders
For each folderIdx In files

Response.Write("<option>" + folderIdx.Name + "</option>")  

Next

%>

i dont know how to make such a dependent list. any help is really appreciated. and i am sorry for the formatting issue

+1  A: 

You'll have to involve JavaScript. What you need to have happen is the static dropdown trigger some event whenever it changes, in order to update your dynamic dropdown. So you can:

  1. Have the JavaScript post the form whenever the static dropdown changes. When this post occurs, you can pull the folders for the dynamic dropdown.
  2. Have the JavaScript trigger an Ajax event whenever the static dropdown changes. I would recommend jQuery for this.

Since the folders change often, those are the only two options I'd recommend. If you need help with a specific implementation, there are lots of resources available (this is a very common feature that people use jQuery/Ajax for), and it should work with any server-side language (classic ASP or otherwise).

mgroves