|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Textarea Max Size form question
Okay, so you've got a textarea...you want to make sure it's not more thanJeff Small 04/29/04 04:05 P there is a thread in the last 30 days that discusses this, check the hofTony Weeg 04/29/04 04:09 P > there is a thread in the last 30 days that discusses this, check the hofJeff Small 04/29/04 04:13 P npTony Weeg 04/29/04 04:14 P You want to use onKeyUp, not onKeyPress, because onKeyPress fires before theBarney Boisvert 04/29/04 04:22 P > Okay, so you've got a textarea...you want to make sure it's not more thanJeff Small 04/29/04 04:10 P <script>Barney Boisvert 04/29/04 04:11 P Okay, so you've got a textarea...you want to make sure it's not more than 1024 characters, but you wanna do a clientside check on it... <keanu reeves> What do you do...what DO you do? </keanu reeves> Any scripts or dreamweaver behaviors anyone know of that can be plugged in quickly for an onblur() check? Is there a CFINPUT solution to this perhaps? I'm not using CFINPUT on any of the other form elements though... there is a thread in the last 30 days that discusses this, check the hof site...its there. http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=317 24&forumid=4 tony Okay, so you've got a textarea...you want to make sure it's not more than 1024 characters, but you wanna do a clientside check on it... <keanu reeves> What do you do...what DO you do? </keanu reeves> Any scripts or dreamweaver behaviors anyone know of that can be plugged in quickly for an onblur() check? Is there a CFINPUT solution to this perhaps? I'm not using CFINPUT on any of the other form elements though... > there is a thread in the last 30 days that discusses this, check the hof > site...its there. > > http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=317 > 24&forumid=4 > > tony Yeah, the script I dug up was basically the same thing...I kept thinking that I had to submit the form to test that, and completely forgot about the "onkeyup() and onkeypress() events.. Thanks tony! np tw > there is a thread in the last 30 days that discusses this, check the > hof site...its there. > > http://www.houseoffusion.com/cf_lists/index.cfm/method=messages&threadid=317 > 24&forumid=4 > > tony Yeah, the script I dug up was basically the same thing...I kept thinking that I had to submit the form to test that, and completely forgot about the "onkeyup() and onkeypress() events.. Thanks tony! You want to use onKeyUp, not onKeyPress, because onKeyPress fires before the character is actually typed. In other words, you trim the string, recount the chars, whatever, and then the character is appended, throwing everything off immediately. Cheers, barneyb ----- Excess quoted text cut - see Original Post for more ----- ----- Excess quoted text cut - see Original Post for more ----- perhaps? > I'm not using CFINPUT on any of the other form elements though... Digging a little further, I found this...it rules... http://javascript.about.com/library/scripts/blcounttext.htm <script> function checkLength(field, len) { if(field.value.length > len) field.value = field.value.substr(0, len); } </script> <form> <textarea onKeyUp="checkLength(this, 10);"></textarea> <input onKeyUp="checkLength(this, 12);" /> </form> ----- Excess quoted text cut - see Original Post for more -----
|
February 08, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||