Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Scripting / December 2004

Tip: Looking for answers? Try searching our database.

TextArea Length  ???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Samir Patel - 20 Nov 2004 06:15 GMT
Hi
I am using Textarea type.I want to set maximum length to the textarea.
I am using following code for the same,but it is not working,

<textarea name="txtDescription" cols=10 rows=3 axlength=50></textarea>
<asp:TextBox Font-Names="verdana" Runat="server" ID="tforumtext"
TextMode="MultiLine" Height="100" Width="300" Font-Size="10"
MaxLength="100">
</asp:TextBox>

But it is not working,it
Help me in the same

Samir (S.E INDIA).
Hayato Iriumi - 28 Nov 2004 08:05 GMT
Hello Samir,

Nope, it won't work. You'll have to write some JavaScript to limit the number
of characters in textarea. You should count the number of characters in the
textarea onchange event, and truncate whatever is over the number of characters
you want to limit to.

> Hi
> I am using Textarea type.I want to set maximum length to the textarea.
[quoted text clipped - 7 lines]
> Help me in the same
> Samir (S.E INDIA).
abtcabe - 09 Dec 2004 19:23 GMT
I concur, the MaxLength event does not work for a textarea.

However, you can also use the keypress event in JavaScript. See the
following ex:

<script language="javascript">

function maxSize(intMaxSize)
{
if (Form1.txtCoverCopy.value.length < intMaxSize)
{
return true;
}
else
{
return false;
}
}

</script>

<asp:TextBox id="txtCoverCopy" runat="server" Width="768px"
TextMode="MultiLine" Height="38px" onkeypress="return
maxSize(10)"></asp:TextBox>
> Hello Samir,
>
[quoted text clipped - 14 lines]
> > Help me in the same
> > Samir (S.E INDIA).
Mythran - 14 Dec 2004 18:07 GMT
>I concur, the MaxLength event does not work for a textarea.
>
[quoted text clipped - 16 lines]
>
> </script>

<textarea onkeypress="javascript:return (this.value.length < 10);">

should work too :P

Mythran

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.