title: Auto Submit form just once
body: <p>I have configured the javascript code to do auto submit but what I want is that if the authentication fails, I do not do the autosubmit again.
  My code is the following:</p>
  
  <p>Form:</p>
  
  <pre><code>&lt;?php echo form_open($this-&gt;uri-&gt;uri_string(), array('class' =&gt; 'login-form')); ?&gt;
      &lt;div class="form-group"&gt;
  
                      &lt;label for="email"&gt;&lt;?php echo _l('clients_login_email'); ?&gt;&lt;/label&gt;
  
                      &lt;input type="text" autofocus="true" class="form-control" name="email" id="email"&gt;
  
                      &lt;?php echo form_error('email'); ?&gt;
  
                  &lt;/div&gt;
  
                  &lt;div class="form-group"&gt;
  
                      &lt;label for="password"&gt;&lt;?php echo _l('clients_login_password'); ?&gt;&lt;/label&gt;
  
                      &lt;input type="password" class="form-control" name="password" id="password"&gt;
  
                      &lt;?php echo form_error('password'); ?&gt;
  
                  &lt;/div&gt;
  &lt;?php echo form_close(); ?&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      window.onload=function(){
          var auto = setTimeout(function(){ autoRefresh(); }, 100);
  
          function submitform(){
              document.forms["login-form"].submit();
          }
  
          function autoRefresh(){
              clearTimeout(auto);
              auto = setTimeout(function(){ submitform(); autoRefresh(); }, 10000);
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>How can I do it?</p>