Home All Groups Group Topic Archive Search About

limiting # of characters for a multiline mode textbox

Author
7 Jul 2005 5:01 PM
Paul
Hi just wondering if there is a way to limit the # of characters for a
multiline textbox?  I am cutting it of in code but would like the user to
know when they have exceeded the character limit, say 1000 for example.
Thanks.
--
Paul G
Software engineer.

Author
7 Jul 2005 5:55 PM
Michael Baltic
Use JavaScript to count the number of characters entered into the textarea
(onkeypress event).

When it reaches the max, cancel the keystroke.  You could also alert the user.

--
Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group

Future Business Model
Loan Origination Services
National City Mortgage


Show quoteHide quote
"Paul" wrote:

> Hi just wondering if there is a way to limit the # of characters for a
> multiline textbox?  I am cutting it of in code but would like the user to
> know when they have exceeded the character limit, say 1000 for example.
> Thanks.
> --
> Paul G
> Software engineer.
Author
7 Jul 2005 6:16 PM
Paul
thanks for the information, just wondering if you could provide a brief
example of what the code might look like. thanks.
--
Paul G
Software engineer.


Show quoteHide quote
"Michael Baltic" wrote:

> Use JavaScript to count the number of characters entered into the textarea
> (onkeypress event).
>
> When it reaches the max, cancel the keystroke.  You could also alert the user.
>
> --
> Staff Consultant II
> Enterprise Web Services
> Cardinal Solutions Group
>
> Future Business Model
> Loan Origination Services
> National City Mortgage
>
>
> "Paul" wrote:
>
> > Hi just wondering if there is a way to limit the # of characters for a
> > multiline textbox?  I am cutting it of in code but would like the user to
> > know when they have exceeded the character limit, say 1000 for example.
> > Thanks.
> > --
> > Paul G
> > Software engineer.
Author
7 Jul 2005 7:32 PM
dotnettester
in HTML for the Text box write a OnKeyDown or OnKeyPress function. In the
function count the length of text if more or equal to the length desired
'return false' or else 'return true'



Show quoteHide quote
"Paul" wrote:

> thanks for the information, just wondering if you could provide a brief
> example of what the code might look like. thanks.
> --
> Paul G
> Software engineer.
>
>
> "Michael Baltic" wrote:
>
> > Use JavaScript to count the number of characters entered into the textarea
> > (onkeypress event).
> >
> > When it reaches the max, cancel the keystroke.  You could also alert the user.
> >
> > --
> > Staff Consultant II
> > Enterprise Web Services
> > Cardinal Solutions Group
> >
> > Future Business Model
> > Loan Origination Services
> > National City Mortgage
> >
> >
> > "Paul" wrote:
> >
> > > Hi just wondering if there is a way to limit the # of characters for a
> > > multiline textbox?  I am cutting it of in code but would like the user to
> > > know when they have exceeded the character limit, say 1000 for example.
> > > Thanks.
> > > --
> > > Paul G
> > > Software engineer.