Users Paste Differently
I’ve been using a relatively generic Javascript textarea counter for several years to restrict the input length on form textareas. I’m not sure where the specific version I’m using came from, but you can find dozens like it on Google.Almost all of them rely on the onKeyDown and onKeyUp events to trigger the script. However, some users still manage to submit text that exceeded the limits, even though the application required Javascript. I could not for the life of me reproduce this issue…until today.
Naturally, when I tried to enter text into the textarea, I just typed it there. But that’s not always what users do. Can you imagine, some users might actually compose text in, say, Microsoft Word and then paste it into a textarea? Maybe they are taking advantage of the spell-checker or grammar-checker. Maybe it’s text that they have composed once, but are submitting to several different sites. Or maybe it’s some reason I can’t even fathom!
When I copy-and-paste text, I highlight it, hit CTRL-c, put my cursor at the destination, and hit CTRL-v. But that’s not always what users do either. And as it turns out, if you right-click and select Paste, neither onKeyDown or onKeyUp are triggered. Adding onBlur and onChange seem to do the trick, though.
Of course, this discovery hasn’t exactly solved the problem: the script we are using simply truncates text that is too long. In Firefox, if your textarea has a scrollbar, it could show the user just the top portion of his or her pasted text. Everything would look OK, and the character count displayed would show, for example, 500 of 500 characters.
I haven’t written a replacement script yet, but something clearly needs to alert the user that text has been truncated. At least, however, I have identified the problem.
1 Comment to Users Paste Differently
Leave a comment
Pages
Archives
- April 2012
- March 2012
- January 2012
- December 2011
- November 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- March 2011
- February 2011
- January 2011
- November 2010
- May 2010
- March 2010
- January 2010
- December 2009
- October 2009
- September 2009
- August 2009
- July 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008

[...] I’ve been thinking more about the textarea counter issue that I mentioned in my previous post (”Users Paste Differently“). [...]