title: Prevent more than one space between words
body: <p>I have a function that prevents people putting numbers or any symbol but letters onkeypress into a text box due to ongoing problems with data entry.</p>
  <pre><code>&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; onkeypress=&quot;return isAlfa(event)&quot;&gt;&lt;/td&gt;
  </code></pre>
  <p>Now some staff for reasons unknown put two spaces between words at random times. So I need to prevent them putting more than one space between words. I want to do this in the same function, but it keeps breaking.</p>
  <pre><code>function isAlfa(evt) {
    evt = (evt || window.event);
    var charCode = (evt.which || evt.keyCode);
  
    if ((charCode &gt; 32)
      &amp;&amp; (charCode &lt; 65 || charCode &gt; 90)
      &amp;&amp; (charCode &lt; 97 || charCode &gt; 122)
    ) {
      return false;
    }
    return true;
  }
  </code></pre>
  <p>How can I prevent them entering more than one space between words?</p>