0 Replies Latest reply on Mar 22, 2008 11:48 AM by spottedcow

    Syncronizing Three Dynamic List boxes

    spottedcow
      I have three list boxes which are populated by cfquerys. If the first one changes the other two must change.
      If the second changes the third one has to change and the first one stay the same.
      I submit the form to inself each time the the boxes are clicked. I'm using javascript to set the action to the same page each time. I have it working if I change the first list box but not when I change the second list box. Thanks in advance.
      Here is the code for the first, second and third list box and the java script.
      <td><select name="site" onchange="submitForm('selected');">
      <cfoutput query="qGetMarketSites">
      <option value="#qGetMarketSites.site#"
      <cfif form.site eq #qGetMarketSites.site#>
      selected
      </cfif>
      >#qGetMarketSites.market#
      </option>
      </cfoutput>
      </select>
      </td>

      <td><select name="city" size="1" onchange="
      <cfset form.prevSite=form.site/>; submitForm('selected');">
      <cfoutput query="qGetCitys">
      <option value="#qGetCitys.city#"
      <cfif form.city eq #qGetCitys.city#>
      selected
      </cfif>
      >#qGetCitys.city#
      </option>
      </cfoutput>
      </select>
      </td>
      <td><select name="npanxx" size="1" onchange="submitForm('selected');">
      <cfoutput query="qGetNPANXXS">
      <option value="#qGetNPANXXS.npanxx#"
      <cfif form.npanxx eq #qGetNPANXXS.npanxx#>
      selected
      </cfif>>#qGetNPANXXS.npanxx#
      </option>
      </cfoutput>
      </select>
      </td>
      <script type="text/JavaScript">
      function submitForm(submitFrom)
      {


      if (submitFrom == 'selected')
      {
      alert(document.form.site.value);
      alert(document.form.prevSite.value);
      document.form.action="getAssignment2.cfm";
      form.submit();
      }
      else
      {
      _CF_checkform(document.form);
      if (_CF_error_exists == false)
      {

      if (document.form.port_Indicator[1].checked)
      {
      if (document.form.foreign_DN.value == " ")
      {
      alert('Foreign DN must be populated');
      }
      else
      {

      document.form.action="selectInventory.cfm";
      form.submit();
      }
      }
      else
      {

      document.form.action="selectInventory.cfm";
      form.submit();
      }
      }
      }
      }
      //-->
      </script>