Max. characters of a TextField
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ayan_Roy
Posted On:   Friday, October 4, 2002 12:04 PM

Can we set the Maximum char. length of a TextField


eg. I want user can not enter more than say 10 characters in any particular TextField

Anyone. pls. help me.

Re: Max. characters of a TextField

Posted By:   Sean_Clarke  
Posted On:   Friday, October 4, 2002 03:25 PM

define the following function:




function textCounter(field, maxlimit) {

if (field.value.length > maxlimit) {
field.value = field.value.substring(0, maxlimit);
alert('You\'ve reached the maximum amount of characters!');
}

}



and then your textarea tag:








where {NAME} is the name of your textarea

About | Sitemap | Contact