473,473 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Limit asp:textarea to 100 chars on client side?

M K
Is there a way to limit an asp:textarea to 100 chars on the client side? The
db only accepts 100 and chops the rest off.
Nov 18 '05 #1
10 1594
Use validation.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:C8**********************************@microsof t.com...
Is there a way to limit an asp:textarea to 100 chars on the client side? The db only accepts 100 and chops the rest off.

Nov 18 '05 #2
M K
I mean, I want them to stop at 100 before they hit submit. Like javascript.
But so I can still programatically read the control.

"Kevin Spencer" wrote:
Use validation.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:C8**********************************@microsof t.com...
Is there a way to limit an asp:textarea to 100 chars on the client side?

The
db only accepts 100 and chops the rest off.


Nov 18 '05 #3
maxlength="100"

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:19**********************************@microsof t.com...
I mean, I want them to stop at 100 before they hit submit. Like javascript. But so I can still programatically read the control.

"Kevin Spencer" wrote:
Use validation.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:C8**********************************@microsof t.com...
Is there a way to limit an asp:textarea to 100 chars on the client
side? The
db only accepts 100 and chops the rest off.


Nov 18 '05 #4
M K
A multy line textarea does not use the maxlength attribute.

Custom validators require a postback, and a recompile of the codebehind,
which I can't do right now.

"clintonG" wrote:
maxlength="100"

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:19**********************************@microsof t.com...
I mean, I want them to stop at 100 before they hit submit. Like

javascript.
But so I can still programatically read the control.

"Kevin Spencer" wrote:
Use validation.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:C8**********************************@microsof t.com...
> Is there a way to limit an asp:textarea to 100 chars on the client side? The
> db only accepts 100 and chops the rest off.


Nov 18 '05 #5
txtRemarks.Attributes.Add("onkeypress","return remarksLength()");

function remarksLength()
{
if (document.all('txtRemarks').value.length >= 100)
{
//alert('Remarks cant be more than 120 characters');
return false;
}
return true;
}

"M K" wrote:
A multy line textarea does not use the maxlength attribute.

Custom validators require a postback, and a recompile of the codebehind,
which I can't do right now.

"clintonG" wrote:
maxlength="100"

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:19**********************************@microsof t.com...
I mean, I want them to stop at 100 before they hit submit. Like

javascript.
But so I can still programatically read the control.

"Kevin Spencer" wrote:

> Use validation.
>
> --
> HTH,
> Kevin Spencer
> ..Net Developer
> Microsoft MVP
> Neither a follower
> nor a lender be.
>
> "M K" <ma**@nospamcenturycolor.com> wrote in message
> news:C8**********************************@microsof t.com...
> > Is there a way to limit an asp:textarea to 100 chars on the client

side?
> The
> > db only accepts 100 and chops the rest off.
>
>
>


Nov 18 '05 #6
M K
So it seems I have to put that in the codebehind, at least the Attributes.Add
line.

"vinay" wrote:
txtRemarks.Attributes.Add("onkeypress","return remarksLength()");

function remarksLength()
{
if (document.all('txtRemarks').value.length >= 100)
{
//alert('Remarks cant be more than 120 characters');
return false;
}
return true;
}

"M K" wrote:
A multy line textarea does not use the maxlength attribute.

Custom validators require a postback, and a recompile of the codebehind,
which I can't do right now.

"clintonG" wrote:
maxlength="100"

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:19**********************************@microsof t.com...
> I mean, I want them to stop at 100 before they hit submit. Like
javascript.
> But so I can still programatically read the control.
>
> "Kevin Spencer" wrote:
>
> > Use validation.
> >
> > --
> > HTH,
> > Kevin Spencer
> > ..Net Developer
> > Microsoft MVP
> > Neither a follower
> > nor a lender be.
> >
> > "M K" <ma**@nospamcenturycolor.com> wrote in message
> > news:C8**********************************@microsof t.com...
> > > Is there a way to limit an asp:textarea to 100 chars on the client
side?
> > The
> > > db only accepts 100 and chops the rest off.
> >
> >
> >

Nov 18 '05 #7
No, you could easily use clientside validation.

Jeff
"M K" <ma**@nospamcenturycolor.com> wrote in message
news:52**********************************@microsof t.com...
So it seems I have to put that in the codebehind, at least the Attributes.Add line.

"vinay" wrote:
txtRemarks.Attributes.Add("onkeypress","return remarksLength()");

function remarksLength()
{
if (document.all('txtRemarks').value.length >= 100)
{
//alert('Remarks cant be more than 120 characters');
return false;
}
return true;
}

"M K" wrote:
A multy line textarea does not use the maxlength attribute.

Custom validators require a postback, and a recompile of the codebehind, which I can't do right now.

"clintonG" wrote:

> maxlength="100"
>
> --
> <%= Clinton Gallagher, "Twice the Results -- Half the Cost"
> Architectural & e-Business Consulting -- Software Development > NET cs*********@REMOVETHISTEXTmetromilwaukee.com
> URL http://www.metromilwaukee.com/clintongallagher/
>
>
>
> "M K" <ma**@nospamcenturycolor.com> wrote in message
> news:19**********************************@microsof t.com...
> > I mean, I want them to stop at 100 before they hit submit. Like
> javascript.
> > But so I can still programatically read the control.
> >
> > "Kevin Spencer" wrote:
> >
> > > Use validation.
> > >
> > > --
> > > HTH,
> > > Kevin Spencer
> > > ..Net Developer
> > > Microsoft MVP
> > > Neither a follower
> > > nor a lender be.
> > >
> > > "M K" <ma**@nospamcenturycolor.com> wrote in message
> > > news:C8**********************************@microsof t.com...
> > > > Is there a way to limit an asp:textarea to 100 chars on the client > side?
> > > The
> > > > db only accepts 100 and chops the rest off.
> > >
> > >
> > >
>
>
>

Nov 18 '05 #8
M K
I simply made this form into it's own project so that I could compile it
separately. Then I did the Attributes.Add and the javascript. (I knew the
javascript, but was hoping to avoid having to do something that would involve
a compile.)

"vinay" wrote:
txtRemarks.Attributes.Add("onkeypress","return remarksLength()");

function remarksLength()
{
if (document.all('txtRemarks').value.length >= 100)
{
//alert('Remarks cant be more than 120 characters');
return false;
}
return true;
}

"M K" wrote:
A multy line textarea does not use the maxlength attribute.

Custom validators require a postback, and a recompile of the codebehind,
which I can't do right now.

"clintonG" wrote:
maxlength="100"

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:19**********************************@microsof t.com...
> I mean, I want them to stop at 100 before they hit submit. Like
javascript.
> But so I can still programatically read the control.
>
> "Kevin Spencer" wrote:
>
> > Use validation.
> >
> > --
> > HTH,
> > Kevin Spencer
> > ..Net Developer
> > Microsoft MVP
> > Neither a follower
> > nor a lender be.
> >
> > "M K" <ma**@nospamcenturycolor.com> wrote in message
> > news:C8**********************************@microsof t.com...
> > > Is there a way to limit an asp:textarea to 100 chars on the client
side?
> > The
> > > db only accepts 100 and chops the rest off.
> >
> >
> >

Nov 18 '05 #9
M K
I've always used custom validators, never could seem to get the standard ones
to work, or if I used standard (out of the box) validators with custom ones,
the standards would fire client-side but the custom wouldn't until postback.
So if the user had 2 issues, they would hit 'Continue' see the msg for the
first (client-side) validator, fix it, hit 'Continue' again, THEN see the msg
for the custom validator.

So, when you say I could easily use clientside validation, when I already
have compiled code behind that I can't change, and I don't see how a standard
validator could validate a textarea length, I am genuinly curious.

Can you post your response here?

"Jeff Dillon" wrote:
No, you could easily use clientside validation.

Jeff

Nov 18 '05 #10
if (document.getElementById("YourTextArea").value.len gth > 100)
alert("Whatever you want to say");
return (false);

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"M K" <ma**@nospamcenturycolor.com> wrote in message
news:30**********************************@microsof t.com...
I've always used custom validators, never could seem to get the standard ones to work, or if I used standard (out of the box) validators with custom ones, the standards would fire client-side but the custom wouldn't until postback. So if the user had 2 issues, they would hit 'Continue' see the msg for the
first (client-side) validator, fix it, hit 'Continue' again, THEN see the msg for the custom validator.

So, when you say I could easily use clientside validation, when I already
have compiled code behind that I can't change, and I don't see how a standard validator could validate a textarea length, I am genuinly curious.

Can you post your response here?

"Jeff Dillon" wrote:
No, you could easily use clientside validation.

Jeff

Nov 18 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris Kennedy | last post by:
I am writing the value from a textarea input box to a cookie. Long story but when I return to the page I want to pull the value from the cookie and put it back in the textbox. When I do this all...
5
by: Jesper Rønn-Jensen | last post by:
I have a textarea that must be limited to 70 characters. No big deal -- at least so I thought. * Textarea must not exceed 70 characters * Exceeding content must be cut off * Must work on input by...
27
by: Mike MacSween | last post by:
Some of my users are getting 'Disk or Network Errors'. I've raised it with the network admins, they're looking into it. In the meantime... My 'standard' error handlers logs errors to a table...
1
by: Remo | last post by:
Hi, I want to know the possiblity and process of an ASP client, which needs to get some UDT from a ATL Server component implemented in VC++. The UDT is basically a C++ class consisting of a BSTR...
10
by: Betina Andersen | last post by:
I have inherited a VB.NET dll that I am using from common asp. My problem is to get the messages from the dll to the Ie client, I can see the messages in the Eventlog on the IIS server so I know...
3
by: majlandt | last post by:
I have the below function witch I use to send mail to reciptents on my maillist from an .asp side I am about to make a bounce back system - and would therefore like to make one extra MailHeader...
3
by: teser3 | last post by:
I have the below that limits the textarea input to 500 characters but cant get the alert message to work. It doesnt show anything. Please advise. <script language="javascript"...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.