title: maxLength property not preventing character entry into an ExtJS MessageBox.prompt()
body: <p>I am displaying a prompt upon click, and I want to be able to limit the number of characters that the user can type in. In the extjs doc, I found information about the maxLength property, and it sounded like that was exactly what I wanted. I figured if I set the maxLength to my desired character limit, that the extjs control would automagically limit the number of characters for me. So far that has not been the case, but it does appear to be validating the input somehow because it outline the textbox in red when the maxLength limit is exceeded. Here is my current code:</p>
  
  <pre><code>var prompt, textArea;
  prompt = Ext.MessageBox.prompt("Hello!", "Hint");
  textArea = prompt.down('textarea');
  textArea.maxLength = 140;
  </code></pre>
  
  <p>Alas, this does nothing to prevent the user from entering more than 140 characters.</p>
  
  <p>Does anyone know how to limit the number of characters in a MessageBox like this? Or could someone tell me why maxLength is not working the way I would have expected?</p>
  
  <p>Thanks</p>
  
  <p>--edit--</p>
  
  <p>As newmount pointed out, it looks like the correct solution to this is to set the maxLength attribute on the textarea tag. Here is a w3 schools link to an example: <a href="http://www.w3schools.com/tags/att_textarea_maxlength.asp" rel="nofollow">http://www.w3schools.com/tags/att_textarea_maxlength.asp</a></p>
  
  <p>The issue for me was selecting the correct tag. For a textarea in ExtJS this looks like:</p>
  
  <pre><code>// true denotes multiline and causes Ext to use textarea tag for input
  var prompt = Ext.MessageBox.prompt("Hello!", "Hint", "", "", true); 
  
  prompt.textArea.inputEl.set({
      maxLength: 140
  });
  </code></pre>
  
  <p>Seems that half the battle is selecting the correct DOM element in the sea of generated tags. Hope this helps someone in the future!</p>
  
  <p><strong>Note:</strong> the maxLength attribute is not supported in Opera or IE9 and earlier (see w3 schools link for citation).</p>