Click to See Complete Forum and Search --> : How to limit the no. of words in the textarea


ntcmlee
12-07-2003, 06:52 PM
Dear all,

I write the the textarea of the form object as follows

<textarea name="Enquiry" cols="50" rows="5"></textarea>


I define the area of the object to be cols="50" rows="5" in the display. Please help me on how to limit the no of rows the clients input, thanks

Regards,
Simon

fredmv
12-07-2003, 06:57 PM
You may find this thread (http://forums.webdeveloper.com/showthread.php?s=&threadid=22213) helpful.

ntcmlee
12-07-2003, 09:11 PM
I have added maxlength="2" into the textarea as follows

<textarea name="Enquiry" maxlength="2" cols="50" rows="5"></textarea>

But the length we input is still limitless, why?

Regards,
Simon


Originally posted by ntcmlee
Dear all,

I write the the textarea of the form object as follows

<textarea name="Enquiry" cols="50" rows="5"></textarea>


I define the area of the object to be cols="50" rows="5" in the display. Please help me on how to limit the no of rows the clients input, thanks

Regards,
Simon

Paul Jr
12-07-2003, 09:17 PM
Originally posted by fredmv
Unfortunately, <textarea> elements do not support the maxlength attribute which all <input> elements do support. However, you can always use JavaScript to emulate this effect.

ntcmlee
12-07-2003, 09:26 PM
Please help me on the javascript in detail, thanks

Simon

Paul Jr
12-07-2003, 09:50 PM
The solution is in the link that fredmv posted.