title: Combinig 2 form fields to do a range search
body: <p>I have been trying to find a method of combining 2 form fields to create a 3rd hidden field for submitting as a numeric range search. I have found numerous examples of combining text fields using javascript but have not been able to make them work, I would be very grateful for any advice as to where I am going wrong or if there is a simple way of doing this.</p>
  
  <p>what I have so far is below</p>
  
  <p>in the head section</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function combprice() {
      var lowprice = document.forms[0].lowprice.value;
      var highprice = document.forms[0].highprice.value;
      document.forms[0].price.value = lowprice + " " + highprice;
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>then the form    </p>
  
  <pre><code>&lt;FORM ACTION="cgi-bin/sales.cgi" METHOD="POST" name="search" id="search"&gt;&lt;table width="220" border="0" cellspacing="0" cellpadding="0"&gt;
  
    &lt;tr&gt;
      &lt;td width="91"  height="30"&gt;&lt;div align="right"&gt;Make &lt;span class="style4"&gt;:&lt;/span&gt; &lt;/div&gt;&lt;/td&gt;
      &lt;td width="129"&gt;
  
        &lt;div align="left"&gt;
          &lt;input name="Make" type="text" size="13" /&gt;
        &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
      &lt;td  height="30"&gt;&lt;div align="right"&gt;Model  &lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;
  
        &lt;div align="left"&gt;
          &lt;input name="Model" type=text size="13" /&gt;
        &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  
    &lt;tr&gt;
      &lt;td  height="30"&gt;&lt;div align="right"&gt;Min Price &lt;span class="style4"&gt;:&lt;/span&gt; &lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;
  
        &lt;div align="left"&gt;
          &lt;input id="lowprice" name="lowprice" type="text" size="13" maxlength="13" /&gt;
        &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
      &lt;td  height="30"&gt;&lt;div align="right"&gt;Max Price &lt;span class="style4"&gt;:&lt;/span&gt; &lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;
  
        &lt;div align="left"&gt;
          &lt;input id="highprice" name="highprice" type="text" size="13" maxlength="13" /&gt;
        &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
      &lt;td colspan="2"&gt;&lt;table width="220" border="0" cellspacing="0" cellpadding="0"&gt;
        &lt;tr&gt;
          &lt;td  height="30"&gt;&lt;div align="right"&gt;Price:&lt;/div&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input name="Price" type="text" id="Price" size="13" maxlength="13"&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td width="90"  height="30"&gt;&amp;nbsp;&lt;/td&gt;
          &lt;td width="130"&gt;&lt;div align="center"&gt;&lt;input name="Submit" type="submit" id="OnSubmit" value="Search" onclick="combprice()"&gt;
  
          &lt;/div&gt;&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/table&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>none of the fields are required fields.</p>
  
  <p>I am aware that the above does not include the &lt;= or => elements, I just have not managed to get that far. 
  Thanks in advance</p>
  
  <pre><code>                Leo 
  </code></pre>