Ok, I'll try this and get back to you. THANX!
Main Topics
Browse All TopicsOk, Is there a way to set a character limit
on a textarea form element? Is there a way
to check if the entered text exceeds a character
limit?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hi,
How abt running this script on a html page & see how it goes !!!
<HEAD>
<SCRIPT LANGUAGE="JavaScript">func
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}
</SCRIPT>
</HEAD>
<!--- ==========================
<BODY>
<CENTER>
<FORM NAME="MYFORM" ACTION="anandkp.cfm"><FONT
<TEXTAREA NAME="message" WRAP="PHYSICAL" COLS="28" ROWS="4" onKeyDown="textCounter(thi
<INPUT READONLY TYPE="TEXT" NAME="remLen" SIZE="3" MAXLENGTH="3" VALUE="125">characters left</FONT>
</FORM></CENTER>
</BODY>
K'Rgds
Anand
Business Accounts
Answer for Membership
by: danrosenthalPosted on 2003-03-28 at 13:51:04ID: 8228052
You can verify the text entered, but you cannot pre-set a limit. Here is how you can verify client-side:
ld.value.l ength>fiel dmaxlength ){ select();
ld.value.l ength>fiel dmaxlength ){
xtarea>
<SCRIPT language="JavaScript">
var fieldmaxlength = 10;
function chkchars(){
if(document.myform.testfie
alert('You have exceded the maxmimum of '+fieldmaxlength+' characters');
document.myform.testfield.
}
}
function chkform(){
if(document.myform.testfie
chkchars();
return false
}
}
</script>
<FORM name="myform" onsubmit="return chkform();">
<TEXTAREA name="testfield" onkeyup="chkchars();"></te
<INPUT type="Submit">
</form>
It is also a good idea to verify on you form processing page as well to guard against hackers and those who have javascript disabled. To do this you just need a simple code like this:
<CFIF len(testfield) gt 10>
-- display error, prevent submit, etc. --
</CFIF>