andycheese
Programmer
Hi, I'd like to know how to setup a textarea in my form which can be no longer than 400 characters long (displayed as 5 lines of 80).
My code is as follows:
<textarea name="textfield" cols="80" rows="5" wrap="soft"></textarea>
Now, I would logically expect that having 5 rows of 80 columns (presumably these are equivalent to characters?) would limit the size of the textarea to 400 chars, however, it appears this is not the case. In its current form, there is no way to stop the user typing more than 400 characters (the text keeps wrapping and a scroll-bar appears on the side of the box). This results in important information being truncated when I retreive the field's contents.
Is there an attribute that I'm not using, or am I doing this incorrectly? Or do I need a script to interrogate the length of the textarea whilst a user types? If so, could a kind soul point me in the right direction?!
Any help would be greatly appreciated!
My code is as follows:
<textarea name="textfield" cols="80" rows="5" wrap="soft"></textarea>
Now, I would logically expect that having 5 rows of 80 columns (presumably these are equivalent to characters?) would limit the size of the textarea to 400 chars, however, it appears this is not the case. In its current form, there is no way to stop the user typing more than 400 characters (the text keeps wrapping and a scroll-bar appears on the side of the box). This results in important information being truncated when I retreive the field's contents.
Is there an attribute that I'm not using, or am I doing this incorrectly? Or do I need a script to interrogate the length of the textarea whilst a user types? If so, could a kind soul point me in the right direction?!
Any help would be greatly appreciated!