Try something like this.  This (should) restrict the textarea to 800
characters, and display how many characters are remaining, in a seperate
textbox:

   <SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>

 <cfform name="REPLIER" method="post" action="post.cfm">
 <textarea name=ReplyMessage wrap=physical cols=27 rows=9
onKeyDown="textCounter(this.form.ReplyMessage,this.form.remLen,800);"
onKeyUp="textCounter(this.form.ReplyMessage,this.form.remLen,800);"></textar
ea>

 <br>
   <input readonly type=text name=remLen size=3 maxlength=3 value="800">
characters left

</cfform>


----- Original Message -----
From: "bajaria aslam" <[EMAIL PROTECTED]>
Newsgroups: cf-talk
Sent: Monday, June 04, 2001 6:41 PM
Subject: Can we limit the text in textarea


> Is there a way to limit the number of characters
> someone can put in a textarea?
>
> Thanks
> AB
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to