title: In JSP, why do my radio buttons cause onSubmit to no longer be called?
body: <p>Major Update: Due to Spring, the validator is called before the onSubmit invocation occurs.  When no radio buttons are selected, this runs fine.   When a radio button is selected, the POST data contains a variable for the radio button and this causes a NestedServletException.</p>
  
  <p>This variable is not bound to any property or class.  Is there a "correct" way that such a variable needs to be handled, either within JSP or within my code?</p>
  
  <hr>
  
  <p>I have a JSP page, hooked up with Spring, where the onSubmit listener is no longer invoked after I add some radio buttons to the JSP page.  Without the radio buttons, a bare version of the page looks like this.</p>
  
  <pre><code>&lt;form:form&gt;
      &lt;fieldset&gt;
          &lt;input type="submit" value="Submit"/&gt;
      &lt;/fieldset&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>This works as expected.  My debugger reaches a breakpoint for onSubmit once the submit button is pressed.  Then I add the following code for radio buttons, which can be seen below.</p>
  
  <pre><code>&lt;form:form&gt;
      &lt;fieldset&gt;
          &lt;input type="submit" value="Submit"/&gt;
      &lt;/fieldset&gt;
  
      &lt;fieldset class="contentHalfFieldset"&gt;&lt;legend&gt;NID&lt;/legend&gt;
          &lt;input type="radio" name="someName" value="value1" /&gt;
          &lt;input type="radio" name="someName" value="value2" /&gt;
          &lt;input type="radio" name="someName" value="value3" /&gt;
      &lt;/fieldset&gt;
  &lt;/form:form&gt;
  </code></pre>
  
  <p>Now, <strong>when I don't select any radio button, the submit button still causes the submission event to reach the breakpoint in the onSubmit method</strong>.  It still works as intended.  However, when I select one of the radio buttons and then press the submit button, the page simply refreshes.</p>
  
  <p>Why is that?  What's happening that makes input buttons prevent the processing of a submission?</p>
  
  <p>------- Generated HTML -------</p>
  
  <pre><code>&lt;form id="cmd" method="post" action="/page/pageAction.html?param=k" onsubmit="disableSubmit(this);"&gt;
      &lt;fieldset class="contentHalfFieldset"&gt;&lt;legend&gt;NID&lt;/legend&gt;
          &lt;label class="labelClass"&gt;First radio button:&lt;/label&gt;
          &lt;input type="radio" name="nidStatus" value="first" /&gt;&lt;br style="clear: both"/&gt;
          &lt;label class="labelClass"&gt;Second radion button:&lt;/label&gt;
          &lt;input type="radio" name="nidStatus" value="second" /&gt;&lt;br style="clear: both"/&gt;
          &lt;label class="labelClass"&gt;Third radio button&lt;/label&gt;
          &lt;input type="radio" name="nidStatus" value="third" /&gt;&lt;br style="clear: both"/&gt;
      &lt;/fieldset&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>------- More Requested Code -------</p>
  
  <p>This is the disableSubmit(..) method.</p>
  
  <pre><code>function disableSubmit(parentElement) {
      elements = parentElement.elements;
  
      for(var i = 0; i &lt; elements.length; i++) {
          var element = elements[i];
  
          if(element.type == "submit") {
              element.disabled=true;
              element.value="Please Wait...";
          }
      }
  };
  </code></pre>