title: $smarty - How to Dynamically change select box option value on the fly
body: <p>I am a newbie of smarty so please pardon my innocence  :oops: </p>
  
  <p>I am following a code left by previous programmer and i have this problem on dynamically changing the values of a select box depending on the selected value of another select box.</p>
  
  <p>So here's the situation:</p>
  
  <p>I have drop down named "Section" and another one named "Subsection".</p>
  
  <p>What i need to come up with is that when i choose a Section the Values of the Subsection will change too and only displays the Subsections which is under that section selected.</p>
  
  <p>here's a javascript simulation of the problem:</p>
  
  <pre><code>&lt;html&gt; 
  &lt;head&gt; 
  &lt;title&gt;Box changing demo&lt;/title&gt; 
      &lt;script type="text/javascript"&gt; 
  
          var items = new Array(); 
  
          items[0] = new Array("Dog", "Cat", "Pig"); 
          items[1] = new Array("Andromeda", "Boötes", "Cepheus"); 
          items[2] = new Array("Mercury", "Venus", "Earth"); 
          items[3] = new Array("BMW", "Audi", "Bugatti"); 
  
          function changeItems(){; 
              num=document.changer.section.options[document.changer.section.selectedIndex].value; 
              document.changer.subsection.options.length = 0; 
              for(i=0; i&lt;items[num].length; i++){ 
                  document.changer.subsection.options[i] = new Option(items[num][i], items[num][i]); 
              } 
          } 
  
      &lt;/script&gt; 
  &lt;/head&gt; 
  &lt;body&gt; 
  
      &lt;form name="changer"&gt; 
           &lt;select name="section" onchange="changeItems();"&gt; 
                &lt;option value="0"&gt;Animals&lt;/option&gt; 
                &lt;option value="1"&gt;Constelations&lt;/option&gt; 
                &lt;option value="2"&gt;Planets&lt;/option&gt; 
                &lt;option value="3"&gt;Cars&lt;/option&gt; 
           &lt;/select&gt; 
  
           &lt;select name="subsection"&gt; 
            &lt;!--&lt;option&gt;tgntgn&lt;/option&gt; --&gt;
           &lt;/select&gt; 
      &lt;/form&gt; 
  
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>This is what i need to do with smarty.</p>
  
  <p>Anybody?</p>
  
  <p>Thank you for your help.</p>