title: React keypress input
body: <blockquote>
    <p>I'm trying to prevent some characters from being entered, but for some reason the ban does not happen. Where was I wrong?</p>
  </blockquote>
  
  <pre><code>render () {
      return &lt;form&gt;
          &lt;input
              id="username"
              type="text"
              placeholder="Username"
              value={this.state.value}
              onKeyPress={this.pale_username.bind(this)}
          /&gt;
      &lt;/form&gt;
  }
  </code></pre>
  
  <p>and function</p>
  
  <pre><code>pale_username(key) {
      if((key.charCode &lt; 48 || key.charCode &gt; 57) //numbers
          &amp;&amp; (key.charCode &lt; 65 || key.charCode &gt; 90) // AB
          &amp;&amp; (key.charCode &lt; 97 || key.charCode &gt; 122) // ab
          &amp;&amp; (key.charCode !== 36) // $
          &amp;&amp; (key.charCode !== 38) // &amp;
          &amp;&amp; (key.charCode &lt; 40 || key.charCode &gt; 41) // ()
          &amp;&amp; (key.charCode &lt; 45 || key.charCode &gt; 46) // -.
          &amp;&amp; (key.charCode !== 95) // _
          &amp;&amp; (key.charCode !== 127) // del
          &amp;&amp; (key.charCode !== 8) // BackSpace
          &amp;&amp; (key.charCode !== 46))
          return false;
  }
  </code></pre>