Is there some way of setting the MaxLength of a TextBox when it is in Mulitline TextMode? MSDN says the MaxLength doesn't work when in Multiline mode, but there has to be a way. I'm trying to make Textbox that allows two lines of input and no more. Ideally,
it wouldn't let the user keep typing... Thanks.
Has anyone found a solution to restricting the user's input in a multiline textbox??? I know that after the user has entered his/her information i can verify that there are the right amount of characters. The problem is that if i am wanting to keep the field
down to 100 characters and they have just spend all of their time entering in 1000 characters, then it's been a complete waste of time for them. What I am trying to find is a way to restrict the length for a multiline textbox as in a singleline textbox; once
the reach character 100....they can't enter any more information. does anyone have a solution to this????
Hi, You can use this JavaScript code to control it ...
<script language="javascript">
function Count(text,long)
{
var maxlength = new Number(long); // Change number to your max length.
if (text.value.length > maxlength){
text.value = text.value.substring(0,maxlength);
alert(" Only " + long + " chars");
}
}
and use it in the text element's events onKeyUp="Count(this,200)" onChange="Count(this,200)"
Can anybody advise why code from Guille.Net cannot work on Mozilla? It would be great if somebody can suggest a solution that can work with Mozilla/Netscape. Thanks. Henry
when I have HTML text area then this code won't work. I spent lots of time fighting for this problem then came up with getElementbyID does anyone have some other solution? thankx mp417
throwexcepti...
Member
215 Points
43 Posts
TextBox.MultiLine maxlength
Aug 28, 2002 07:24 PM|LINK
lacol
Participant
1030 Points
207 Posts
Re: TextBox.MultiLine maxlength
Aug 28, 2002 08:12 PM|LINK
throwexcepti...
Member
215 Points
43 Posts
Re: TextBox.MultiLine maxlength
Aug 28, 2002 08:40 PM|LINK
amr04
Member
55 Points
11 Posts
Re: TextBox.MultiLine maxlength
Mar 14, 2003 02:47 PM|LINK
Guille.Net
Member
25 Points
5 Posts
Re: TextBox.MultiLine maxlength
Mar 14, 2003 05:17 PM|LINK
<script language="javascript"> function Count(text,long) { var maxlength = new Number(long); // Change number to your max length. if (text.value.length > maxlength){ text.value = text.value.substring(0,maxlength); alert(" Only " + long + " chars"); } }and use it in the text element's events onKeyUp="Count(this,200)" onChange="Count(this,200)"Visit my Site:
ASP & PHP Developer
amr04
Member
55 Points
11 Posts
Re: TextBox.MultiLine maxlength
Mar 14, 2003 05:48 PM|LINK
lacol
Participant
1030 Points
207 Posts
Re: TextBox.MultiLine maxlength
Mar 14, 2003 08:31 PM|LINK
henrylo
Member
15 Points
3 Posts
Re: TextBox.MultiLine maxlength
Feb 16, 2004 04:04 AM|LINK
pickyh3d
Star
9696 Points
1955 Posts
Re: TextBox.MultiLine maxlength
Feb 16, 2004 04:26 AM|LINK
<script language="javascript"> function Count ( text, maxlength ) { if ( text.value.length > maxlength ) { text.value = text.value.substring(0, maxlength); alert("Only " + maxlength + " chars"); } } </script>mp417
Contributor
2658 Points
549 Posts
Re: TextBox.MultiLine maxlength
Feb 16, 2004 06:37 AM|LINK