Without JS there's nothing you can do on the client. Make it clear there is
a limit and send them back if they break the limit and let them know how
much they were out by.

Adrian Lynch

-----Original Message-----
From: Steve LaBadie
Sent: 12 December 2007 19:24
To: CF-Talk
Subject: SOT: Limit content in Textarea?


I am using JavaScript to limit the amount of text on can submit in the
textarea. Realizing disabling JavaScript may allow people to enter more
than 300 characters in the textarea field. Does anyone have any
suggestions or thoughts?



JavaScript:



<script type="text/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;
}
</script>



<textarea name="problemDesc" wrap="physical" cols="50" rows="8"
onKeyDown="textCounter(this.form.problemDesc,this.form.remLen,300);"
onKeyUp="textCounter(this.form.problemDesc,this.form.remLen,300);"
class="formveld"></textarea>



Steve LaBadie, Web Manager


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:294669
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to