title: Submit form when timer countdown is expire
body: <p>I used <a href="http://keith-wood.name/countdown.html" rel="nofollow noreferrer">jQuery Countdown</a> to make a timer count down for my page. This is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
    function timeup() {
      $("examination_form").submit();
    }
  
    $(document).ready(function() {
      var duration = &lt;%= @remaining_minutes %&gt;
      $('#countDownTimer').countdown({until: '+' + duration  + 'm', 
                      format: 'MS', 
                      description: "Time Remaining",
                      onExpiry: timeup
                        });
  
    $("#countDownTimer").jScroll({top: 100});
  
    $("#examination_form").submit(function() {
      var errors = []
      $(".content_question").each(function() {
        var answerCont = $(this).next();
        var inputs = $(answerCont).find('input[type=radio], input[type=checkbox]');
  
        if(inputs.length &gt; 0)
        {
          var groupChecked = false;
  
          $(inputs).each(function(){
            if($(this).is(':checked'))
            {
              groupChecked = true;
            }
          });
  
          if(!groupChecked)
          {
            errors.push($(this).text().trim());
          }
        }
      });
  
      if(errors.length &gt; 0)
      {
        var errorMessage = "You missed " + errors.length + " questions: \n\n";
  
        for(var i=0; i&lt;errors.length; i++)
        {
          errorMessage += errors[i] + "\n";
        }
        alert(errorMessage);
        return false;
      }
    });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The code from <code>$("#examination_form").submit(function() {</code> to end is used to check if user missed check answers for some questions, they will be alerted when they press submit.</p>
  
  <p>I used callback event <code>onExpiry</code> to submit form when time out, but it did not do anything. I think it has something wrong but I didn't know where. Before I tried:</p>
  
  <pre><code>onExpiry: function(){
    $("examination_form").trigger('click');
  }
  </code></pre>
  
  <p>but it just like I press button submit, while I want the form is submited. I tried answers in <a href="https://stackoverflow.com/questions/10079306/jquery-countdown-autosubmit-form-upon-expiration">this question</a> but it didn't worked too.</p>
  
  <p>Anyone can help?</p>