title: How to populate two text fields from one select drop-down
body: <p>I have the following HTML produced by CakePHP's form helper. In the interface, the user is selecting two dates which are then used in the resulting PHP to pull data from MySQL. I have also provided the user with "financial months", which are defined in MySQL as a shortcut to pre-populate the two date fields. However, I have absolutely no idea how to achieve this as my jQuery/Javascript knowledge is very limited.</p>
  
  <p>What I want to do:
  When user selects something from the SELECT box, the value of the option before the _ is pulled in to date1, and the value of the option after the _ is pulled in to date 2.</p>
  
  <p>Is this possible?</p>
  
  <p>edit:
  Here is the code in CakePHP that produces the form:</p>
  
  <pre><code>&lt;script type="text/javascript" src="/js/revenuelines.js"&gt;&lt;/script&gt;
  
  &lt;h1&gt;Lock revenue&lt;/h1&gt;
  
  &lt;div class="inner"&gt;
  
      &lt;p&gt;Select two dates to lock revenue for the specified period.&lt;/p&gt;
  
      &lt;?php
  
      echo $this-&gt;Form-&gt;create('lock');
  
      ?&gt;
  
      &lt;span&gt;Between&lt;/span&gt;
      &lt;?php
  
      echo $this-&gt;Form-&gt;input('RevenueLine.date1', array('div' =&gt; false, 'class' =&gt; 'input datepicker', 'label' =&gt; false));
  
      echo "&amp;nbsp;and&amp;nbsp;";
  
      echo $this-&gt;Form-&gt;input('RevenueLine.date2', array('div' =&gt; false, 'class' =&gt; 'input datepicker', 'label' =&gt; false));
  
      echo $this-&gt;Form-&gt;submit('Submit', array('label' =&gt; false, 'div' =&gt; false, 'class' =&gt; 'submit_black gradient', 'style' =&gt; 'display: inline;')); 
  
      echo $this-&gt;Form-&gt;input('FinancialMonth.selector', array('label' =&gt; '&amp;nbsp;&amp;nbsp;&amp;nbsp;...or select financial month to auto-populate&amp;nbsp;&amp;nbsp;&amp;nbsp;', 'div' =&gt; false, 'class' =&gt; 'input', 'options' =&gt; $months));
  
      echo $this-&gt;Form-&gt;end(); 
  
      ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the actual HTML produced:</p>
  
  <pre><code>&lt;div id="content"&gt;
  
                          &lt;script type="text/javascript" src="/js/revenuelines.js"&gt;&lt;/script&gt;
  
  &lt;h1&gt;Lock revenue&lt;/h1&gt;
  
  &lt;div class="inner"&gt;
  
      &lt;p&gt;Select two dates to lock revenue for the specified period.&lt;/p&gt;
  
      &lt;form action="/revenue_lines/lock" id="lockLockForm" method="post" accept-charset="utf-8"&gt;&lt;div style="display:none;"&gt;&lt;input type="hidden" name="_method" value="POST"&gt;&lt;/div&gt;
      &lt;span&gt;Between&lt;/span&gt;
      &lt;input name="data[RevenueLine][date1]" class="input datepicker hasDatepicker" type="text" id="RevenueLineDate1"&gt;&amp;nbsp;and&amp;nbsp;&lt;input name="data[RevenueLine][date2]" class="input datepicker hasDatepicker" type="text" id="RevenueLineDate2"&gt;&lt;input class="submit_black gradient" style="display: inline;" type="submit" value="Submit"&gt;&lt;label for="FinancialMonthSelector"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...or select financial month to auto-populate&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/label&gt;&lt;select name="data[FinancialMonth][selector]" class="input" id="FinancialMonthSelector"&gt;
  &lt;option value="22JUN2013_26JUL2013"&gt;2013 - July&lt;/option&gt;
  &lt;option value="27JUL2013_30AUG2013"&gt;2013 - August&lt;/option&gt;
  &lt;/select&gt;&lt;/form&gt;&lt;/div&gt;
                      &lt;/div&gt;
  </code></pre>