hi 
theres some code below that I found somewhere that does this, it should do
what you need

the textbox below the textarea gives a countdown of characters left and
starts counting down as they type.

HTH
Mark
Mark Smyth 
Macromedia Certified ColdFusion Developer 
Systems Union eBusiness Solutions 
01865 880800 
[EMAIL PROTECTED] 
www.systemsunion.net





<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...this trims it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}
// End -->
</script>

<textarea cols="57" rows="10" name="agenda"
onKeyDown="textCounter(this.form.agenda,this.form.remLen3,250);"
onKeyUp="textCounter(this.form.agenda,this.form.remLen3,250);"></textarea>

<font size="-2">There are: 
<input readonly type=text name=remLen3 size=3 maxlength=3 value="250">
characters still available in the notes field

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]]
Sent: 20 August 2001 10:53
To: CF-Talk
Subject: Re: Limiting text entered into TextArea


[EMAIL PROTECTED] wrote:

> i guess it is compare with fieldname.length.

Almost, it is compared with formname.value.length like in the example 
below. Doesn't work flawlessly (one can paste stuff into the field 
without pressing a key), but it is a start.

<textarea name="text" onkeypress="return checkLength(this,500)">

<script language="JavaScript">
        function checkLength(formfield,limit) {
                if (formfield.value.length > limit) {
                        alert("Only " + limit + " characters allowed.");
                        return false;
                        }
                }
        </SCRIPT>


----------------------------------------------------------------------------
----------------------------------------------------------------------------
----------------------------------------------
> 
>  The information transmitted is intended only for the person or entity to
> which it is addressed and may contain confidential and/or privileged
> material.  Any review, retransmission,  dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipient is prohibited.   If you
received
> this in error,  please contact the sender and delete the material from any
> computer.
> -- Phoenix Global Solutions (India) Pvt Ltd., www.pgsolutions.com

I am retransmitting and also kindly inviting you to take legal action 
against that.


Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to