Jump to content

Max Length in textarea


mikelmao

Recommended Posts

I don't know that a textarea HAS a max number of characters. But if you are using GET in your form field, you have a limit if... around 2000 characters I believe, though I don't remember exactly how much. POST will be limited by the settings in your php.ini file, as well as the RAM on the processing computer.

 

So, while the textarea may not have a maximum number of characters (I'm not 100% sure on that), you will have limits to how much data can be transmitted by that textarea.

<!-- 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>

 

Place in <body>

 


<!-- textCounter() parameters are:  text field, the count field, max length -->

<form name=myform action="YOUR-SCRIPT.CGI">
<font size="1" face="arial, helvetica, sans-serif"> ( You may enter up to 125 characters. )<br> //change 125
<textarea name=message wrap=physical cols=28 rows=4 onKeyDown="textCounter(this.form.message,this.form.remLen,125);" // change 125 to anything you wish
onKeyUp="textCounter(this.form.message,this.form.remLen,125);"></textarea> // change to same as abovce
<br>
<input readonly type=text name=remLen size=3 maxlength=3 value="125"> characters left</font> // change 125
</form>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.