Re: Limiting character input in <textarea>
| From: | Richard Davey | Date: | Tue, 16 Nov 2004 08:12:28 +0000 |
| Subject: | Re: Limiting character input in <textarea> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202116@lists.php.net to get a copy of this message | ||
Hello Garth,
Tuesday, November 16, 2004, 7:59:35 AM, you wrote:
GHS> Unlike the input fields that use maxlength to define the number of character
GHS> allowed. Textarea doesnt seem to have that capability. I want to limit the
GHS> number of character to 255.
GHS> IS there any way of doing this without having to break my neck about it?
Client-side, only with JavaScript.
Server-side, just count how many characters they have entered:
if (strlen($textarea_content) > 255)
{
echo "Error message here";
}
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde