Javascript User entry validation

I have a form with an ID input box. If the id is less than 6 characters i want to disable the submit button until it reaches the 7th character. What I found was that users sometimes Type their id, or Paste using keyboard (ctrl-v) or use their mouse right-click-paste.
So I need to trigger my chkid() function with 3 different events. onPaste was new to me and it works because the value of the clip board is passed rather than waiting for the dom to recognize this.value in the input.

<cfinput id="some_id" type="text" onChange="chkid(this.value)" onKeyUp="chkid(this.value)" onpaste="chkid(window.clipboardData.getData('Text'));">

NOTE: onPaste is an MSIE function only. There are methods for gecko based browsers.

Cup size   
Select size then click on coffee cup.
This entry was posted in Code, Javascript, Problems & Fixes, Snippets. Bookmark the permalink.