TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

March 29, 2024, 04:33:44 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,105
  • Total Topics: 21,213
  • Online today: 77
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 67
  • Total: 67

Character countdown for the shoutbox.

Started by WillyP, January 11, 2014, 02:21:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

WillyP

Replaced with a whole new script. In the head:<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>


In the shout template textarea:onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,250);"
onKeyUp="limitText(this.form.'. $context['tp_shout_post_box_name']. ',this.form.countdown,250);"


And below the textarea: <input readonly type="text" name="countdown" size="3" value="250"> characters left<br />

This code lifted from: How to Limit the Number of Characters in a Textarea or Text Field

IchBin

Good work WillyP! Yeah I've often thought about these things. Useful to have, and not a big problem to implement as you noticed. :)