title: Drupal onChange auto populate another CCK select list
body: <p>I have built a multistep form using CCK, however I have a couple of issues outstanding but, not sure if CCK can help.</p>
  
  <p>In one step of the form I have 2 select boxes, the first is auto populated from the vocabulary table with the following code and all woks well.</p>
  
  <pre><code>$category_options = array();
  $cat_res = db_query('select vid, name from vocabulary WHERE vid &gt; 1 ORDER BY name ASC');
  while ($cat_options = db_fetch_object($cat_res)) {
    $category_options[$cat_options-&gt;vid] = $cat_options-&gt;name;
  }
  return $category_options;
  </code></pre>
  
  <p>What I would like to do is, when a user selects one item from the vocablulary list it auto populates another select box with terms from the term_data table. I have 2 issues;</p>
  
  <p>1) I have added the following code to the second select list, just to make sure it works (IT DOESN'T). There a multiple terms associated with each vocabulary, but the second sql statemant only returns one result when it should return several, (SO SOMETHING WRONG HERE). For example in the term_date table there are 6 terms with the vid of 3, but I only get one added to select list.</p>
  
  <pre><code>$term_options = array();  
  $term_res = db_query('select vid, name from term_data WHERE vid = 3 ORDER BY name ASC'); while ($options = db_fetch_object($term_res)) {    
  $term_options[$options-&gt;vid] = $options-&gt;name;  
  }  
  return $term_options;
  </code></pre>
  
  <p>2) Can I add an onChange to the first select list to call a function to auto populate second list using CCK, or do I have to lean towards doing my entire form using the FORM API.</p>
  
  <p>Any help or thoughts would be very much appreciated.</p>