title: javascript to change hidden value then submit form
body: <p>(I've searched for something similar, but haven't found anything that matches and/or works)</p>
  
  <p>I have a progress review form where the user reviews their settings from previous steps.  Below is the form as I have it now:</p>
  
  <pre><code>&lt;form id='reviewForm' name='reviewForm' action='?action=ae&amp;view=makeWorkFlow' method='post'&gt;
      &lt;table width='100%'&gt;
          &lt;tr&gt;
              &lt;th width='150'&gt;Workflow Name&lt;/th&gt;
              &lt;td&gt;" . $workflowName . "&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;th valign='top'&gt;Tasks&lt;/th&gt;
              &lt;td&gt;
                  &lt;table width='99%'&gt;
                      &lt;tr&gt;
                          &lt;td&gt;
                              &lt;select name='task_1'&gt;
                                  &lt;option value='0'&gt;Select a Task&lt;/option&gt;
                                  &lt;ALL OTHER OPTIONS&gt;
                              &lt;/select&gt;
                          &lt;/td&gt;
                          &lt;td&gt;&lt;input type='text' name='turnAround_1' value='#VALUE#' onkeyup="if (/[a-z\s,$]/ig.test(this.value)) this.value = this.value.replace(/[a-z\s,$]/ig,'')" placeholder='Turn Around Time (hours)' /&gt; Hours&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td colspan='2'&gt;
                  &lt;input type='hidden' id='step' name='step' value='4' /&gt;
                  &lt;input type='submit' name='submit' value='Create Workflow' /&gt;&amp;nbsp;&amp;nbsp;
                  &lt;input type='button' value='Update Changes' onclick='setStep();' /&gt;&amp;nbsp;&amp;nbsp;
                  &lt;input type='button' value='Cancel' onclick='javascript:history.go(-3);' /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So, basically, the user has already selected items from a list of dropdowns.  I need to show them a "review" page where they have the option to change their selections and click the "Update Changes" button.  When the click that button, the value of the "step" hidden field needs to be changed from 4 to 3 and then submit the form via the "setStep" function, which is as follows:</p>
  
  <pre><code>&lt;script language='JavaScript' type='text/javascript'&gt;
      function setStep()
      {
          document.forms["reviewForm"].step.value = 3;
          var t = setTimeout("document.reviewForm.submit();", 0);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>I realize that the setTimeout isn't the best way to do it, but it's just where I'm out now in trying to figure this out.  I'm sure it's some small thing i'm missing that would fix this, but I've been at this for just over an hour and can't find it.</p>