RE: TEXTAREA form field

by "Andrew Knox" <andrew.knox(at)emulous.co.uk>

 Date:  Tue, 6 Feb 2001 09:41:23 -0000
 To:  "'Davies,
Elizabeth H.'" <EHDavies(at)West.com>,
"'HWG-technique Mailing List (E-mail)'" <hwg-techniques(at)hwg.org>
 In-Reply-To:  wtc
  todo: View Thread, Original
You need to use javascript... what i usually do is add an onSubmit="return
validate();" to the form tag... the validate() being a function in the
<HEAD> part of the page. Validate would look something like this:

function validate()
{
	if (document.formName.textareaName.value.length > 30)
	{
		alert("Sorry. The maximum number of characters, 30, was exceeded on the
textarea. Please try again.");
		return false;
	}
	return true; // to get here, the above test must be OK
}

Hope that's OK,
Andrew Knox

>> -----Original Message-----
>> From: owner-hwg-techniques(at)hwg.org
>> [mailto:owner-hwg-techniques(at)hwg.org]On Behalf Of Davies,
>> Elizabeth H.
>> Sent: 02 February 2001 21:00
>> To: HWG-technique Mailing List (E-mail)
>> Subject: TEXTAREA form field
>>
>>
>> Is there a way to limit the number of characters (client
>> side) that go into
>> a TEXTAREA box? Our database limit is 256 characters, and
>> while we have it
>> limited on the db side, I'd like to be able to let the
>> person filling out
>> the form when they've hit the end. MAXLENGTH doesn't apply
>> to TEXTAREAS,
>> only text boxes.
>>
>> Elizabeth Davies
>> West Interactive
>> Systems Development
>> Web Designer
>> (402)573-3386 (West6: X206-7562)

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA