You could do something like this:

<html>
<head>
    <title>Untitled</title>

    <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
        function fncCheckLength() {
            document.forms[0].txtLength.value =
document.forms[0].txtTextArea.value.length

             if (document.forms[0].txtTextArea.value.length >= 255) {
                alert("You have reached the limit of 255 characters for this
text box.  Anything you tpe beyond this point will be truncated.")
            }
            return false
        }
    //-->
    </SCRIPT>



    <META NAME="generator" CONTENT="Allaire HomeSite 4.0">
</head>

<body>
    <form action="" method="post">
        <textarea name="txtTextArea" wrap="soft" rows="5" cols="30"
onkeyup="fncCheckLength();"></textarea><br>
        <input type="Text" disabled width="4" value="0" name="txtLength">
    </form>
</body>
</html>

Todd Ashworth
Saber Corporation
(803) 327-0137 [111]

----- Original Message -----
From: "Patricia Lee" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Friday, February 02, 2001 2:21 PM
Subject: RE: Brain Fart


| len(form.specialrequest) returns the number of characters.
|
| If you want to automatically chop off at 255 rather than letting them
| re-enter, then you'll want to use the Mid() function as well.
|
| What would be very nice (and I'd love to see an example from someone who
| already knows how), would be to use JavaScript to alert and hopefully stop
| the user when they've typed in characer 256.
|
| Patricia Lee
| ****************************************************
| Cold Fusion Developer & Instructor, ACCD
| Fig Leaf Software "We've Got you Covered"
| ****************************************************
| [EMAIL PROTECTED]    ****    202.797.5426    ****



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to