maxlength on textarea

S

Sue

Hi,

Textboxes can have maxlength but textarea cant. Is there
a way to limit the number of characters in a textarea to
say 50?

Thanks.
 
L

Luke Nyswonger [MSFT]

Hi Sue,

Thats correct, there is no maxlength for textarea. One way to work around this would be to use javascript. Here is a sample:

if (document.frmName.strTextBox.value.length > 50){
alert("Your message is too large. It needs to be less than 50 characters!");
document.frmName.strTextBox.focus();
return false;
}

Check around for full samples on javascript for the length. You could also validate it on the server side.

Regards,
Luke [MSFT]

**This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. © 2003 Microsoft
Corporation. All rights reserved.**
 

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

Top