This can be done with JavaScript. There's a custom tag in the gallery to do
it.
Is there a way to limit the number of characters
someone can type in in a textarea input box?
Thanks
AB
~~
Structure your ColdFusion code with Fusebox. Get the
Well there isn't a maxlength BUT after they hit submit, on the action page,
before it processes anything else, you can have CF COUNT the characters in
that
string and if they exceed a certain number you can give them a message
telling
them so. There are also javascripts that will count
Not with straight HTML, but you can do it with JavaScript - something like
onKeyPress=if(document.FORMNAME.TEXTAREANAME.value.length 500) {
alert('Only 500 characters allowed') }
You can also do it, obviously, when the form is submitted:
cfif Len(form.TEXTAREANAME) GT 500
cfabort
There are two ways that I am aware of.
One make Cf show a Please limit your input to 125 letters message with
server side validation.
The other is to use java script.(client side validation)
http://javascript.internet.com/forms/limit-textarea.html
Mark W. Breneman
-Cold Fusion Developer
You can do it in Javascript
function lencheck(obj_value, len){
// Returns true if value is less than or equal to length,
// otherwise returns false.
if (obj_value.length = len){
return true;
} else {
over = obj_value.length - len;
Try something like this. This (should) restrict the textarea to 800
characters, and display how many characters are remaining, in a seperate
textbox:
SCRIPT LANGUAGE=JavaScript
!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length maxlimit) // if too
Yes,
Javascript. This is what I used.
cfif #Len(form.descrip)# GT 750
SCRIPT LANGUAGE=JavaScript TYPE=text/javascript
!--
alert ('Your Description exceeds the space alotted. If more detail
is required submit description as Word document file.')
Try this:
html
head
titleMy Page/title
script language=JavaScript
function textCounter(field, countfield, maxlimit)
{
if (field.value.length maxlimit)
field.value = field.value.substring(0, maxlimit);
else
countfield.value = maxlimit - field.value.length;
}
function openWin( windowURL,
8 matches
Mail list logo