limiting # of characters for a multiline mode textbox

P

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.
 
M

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
 
P

Paul

thanks for the information, just wondering if you could provide a brief
example of what the code might look like. thanks.
 
D

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'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top