title: Change a form value before submitting via JavaScript
body: <p>I've been through a lot of questions on similar issues, but can't seem to get this working.  What I'm trying to do is when a button is clicked, replace the value of a form field with the word 'now' and then submit the form.  Initially, the HTML form looks like this:</p>
  
  <pre><code>&lt;tr id="row43" bgcolor="#FF0000"&gt;
  &lt;form id="form43" name="loggingUpdate" action="index.php" method="POST"&gt;
  &lt;td&gt;PersonsName&lt;/td&gt;&lt;td&gt;SGS 1-26&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="takeoff" id="takeoff43"/&gt;&lt;a href='#' onclick='startTakeoff(43);return false;'&gt;&lt;img alt='Start Now' src='brush_24.png' border='0'&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="landing" /&gt;&lt;/td&gt;&lt;td&gt;0 Mins&lt;/td&gt;
  &lt;td&gt;&lt;input type="text" name="towHeight" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type="hidden" name="flightIndex" value="43"/&gt;&lt;input type="submit" value="Update..." /&gt;  &lt;a href=deleteEntry.php?flightIndex=43&gt;&lt;img src="close_24.png" /&gt;&lt;/a&gt;&lt;/td&gt;
  &lt;/form&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>The Javascript that's triggered by the onclick is as shown below:</p>
  
  <pre><code>function startTakeoff(flightIndex) { 
      var flightForm = document.getElementById("form"+flightIndex);
      var flightRow = document.getElementById("row"+flightIndex);
  
      flightRow.cells[2].innerHTML = "&lt;input type=\"text\" name=\"takeoff\" value=\"now\"&gt;&lt;a href=\"#\" onclick=\"startTakeoff(43);return false;\"&gt;&lt;img alt=\"Start Now\" src=\"brush_24.png\" border=\"0\"&gt;&lt;/a&gt;";
      flightForm.submit();
  }
  </code></pre>
  
  <p>So when the button is clicked, it should replace the cell's value with 'now' and submit the form.  The trouble is while it does submit, the changed value doesn't actually get submitted.  If I manually add something to one of the other fields (the towHeight for example) and click the button, it does get submitted successfully.  In other words, it is only the 'takeoff' field that doesn't get submitted when the button is clicked.  I've never worked with Javascript before, so this seems very odd to me.  </p>
  
  <p>In the way of background, there is a PHP script that's generating the HTML and taking the submitted input, hence some of the strange IDs.  The entire page can be seen here in case I've left anything out <a href="http://ad7zj.net/logging/index.php" rel="nofollow">http://ad7zj.net/logging/index.php</a>  I'd appreciate the help!  </p>