1 Reply Latest reply on Jun 28, 2006 3:59 PM by Dan Bracuk

    select based on select

      I have two selects on a form. The first select is populated with directories in the root. The directories in the root may have subdirectories. If a directory with subdirectories is chosen in the first select, I want the second select to be populated with the subdirectories. The selects will be used to allow users to choose a directory and one subdirectory in which to upload a file. Here's what I have so far:

      <form action="uploadSection.cfm" method="post" name="upload" enctype="multipart/form-data" class="body">
      <p>Choose folder to put file in:<br />
      <select name="mnuFolder" onchange="populateSubFolder()">
      <cfdirectory action="list" directory="D:\theroot\" name="Parent_Folder">
      <cfloop query="Parent_Folder">
      <cfif #Parent_Folder.Type# eq "Dir">
      <option value="#Parent_Folder.Name#\">#Parent_Folder.Name#</option>
      <br />

      Choose subfolder (if any):<br />
      <cfdirectory directory="theroot\#Parent_Folder.Name#\" name="Sub_Folder">
      <select name="mnuSubFolder">
      <cfoutput query="Sub_Folder" group="name">
      <cfif #Sub_Folder.type# IS "DIR">
      <option value="#Sub_Folder.Name#\">#Sub_Folder.Name#</option>

      The first select is populated as expected but the second remains empty even if you choose a directory in the first.

      Any ideas are greatly appreciated.

      Doug Wilder
      Fairbanks, AK