Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do you limit textarea of a form

by newrisedesigns (Curate)
on Dec 19, 2002 at 14:59 UTC ( [id://221124]=note: print w/replies, xml ) Need Help??


in reply to How do you limit textarea of a form

In the text of the page, put "X character limit." Then $text = substr($text, 0, X)

You can also add the following as a guide to your form-submitters.

<input value="X" size="3" name="msgCL" disabled> <script language="JavaScript"> <!-- var supportsKeys = false function tick() { calcCharLeft(document.forms[0]) if (!supportsKeys) timerID = setTimeout("tick()",200) } function calcCharLeft(sig) { clipped = false maxLength = 200 //Change this. if (document.creator.signature.value.length > maxLength) { document.creator.signature.value = document.creator.signature. +value.substring(0,maxLength) charleft = 0 clipped = true } else { charleft = maxLength - document.creator.signature.value.length } document.creator.msgCL.value = charleft return clipped } tick(); //--> </script>

Hope this helps

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://221124]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-19 12:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found