RE: [PHP] textarea limit
| From: | Joseph Blythe | Date: | Thu, 10 Apr 2003 06:24:24 +0000 |
| Subject: | RE: [PHP] textarea limit | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143276@lists.php.net to get a copy of this message | ||
A really simple solution would be:
<script language="JavaScript" type="text/JavaScript">
function maxLength(num) {
if (form1.textfield.value.length > num) {
form1.textfield.focus();
form1.textfield.select();
alert("Hey too much input!");
}
}
</script>
<form name="form1" method="post" action="">
<textarea name="textfield" rows="3"
onBlur="maxLength(10)"></textarea>
</form>
Or do a onSubmit event to stop them submitting the form if too much was
entered...
Regards,
Joseph
-----Original Message-----
From: carol [mailto:carol@romag.ro]
Sent: Thursday, 10 April 2003 3:21 PM
To: php-general@lists.php.net
Subject: [PHP] textarea limit
I try to limit the number of characters in a textarea to 254 but I=20
can't. Could anyone help me? pls...