title: Calculate then change form field value onselect
body: <p>I have a form that has some field values pre-populated from a PHP query. I am trying to change the value of the AMOUNT field by adding $2.00 to the existing value if a selection made in field "os0" contains "XX" anywhere in the selected value. I am having trouble getting the javascript code correct to make this work, i think im using the DOM wrong but not sure. The remote URL is only receiving the value set by the PHP echo on submit, regardless of the option/value selected for field "os0". Any help please.</p>
  
  <pre><code>&lt;form method="post" action="remote-url" name="ppal"&gt; 
  &lt;input type="hidden" name="amount" value="&lt;?=$res[0]?&gt;"&gt;
  &lt;input type="hidden" name="SKU" value="&lt;?=$res[1]?&gt;"&gt;
  &lt;select id="os0" name="on0" onChange="setval()"&gt;
  &lt;option value="Small"&gt;Small&lt;/option&gt;
  &lt;option value="Medium"&gt;Medium/option&gt;
  &lt;option value="Large"&gt;Large&lt;/option&gt;
  &lt;option value="XL"&gt;X-Large&lt;/option&gt;
  &lt;option value="XXL"&gt;XXL&lt;/option&gt;
  &lt;option value="XXXL"&gt;XXXL&lt;/option&gt;
  &lt;input name="submit" type="submit" value="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My Javascript:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function setval()
    {
    if (document.forms["ppal"].os0.value.indexOf("XX") &gt; -1) {document.getElementById("amount") = document.getElementById("amount")+2};
    }
    &lt;/script&gt;
  </code></pre>