Max/min number of letters in a topic
Description
Set a minimal/maximal number of letters in a topic
Set up
Paste this code in your javascript panel
- Code:
<!--
// Source: www.fmcodes.com
function conta(val) {
max=100
if (val.testo.value.length > max) {
val.testo.value = val.testo.value.substring(0,max)
rest = 0
}
else {
rest = max - val.testo.value.length
}
val.num.value = rest
}
// End -->
Now, paste this html code in your template near the reply-box area
- Code:
<!--- Subject: "Letters on topics" - Copyright 2012 by www.fmcodes.com. All Rights Reserved. Use and/or modification of this script is allowed, provided this entire copyright notice remains in the original or modified code. Distribution is not allowed without written consent from FMCodes---!>
<form name="web-link">
<textarea name="testo" rows="4" cols="30" wrap="soft" onkeyup="conta(this.form)"></textarea>
<input value="100" size="3" name="num" disabled="">
</form>
Customize the tutorial
You must edit "max=100" with the number of letters/numbers you want; of course using "min=100" you can set the minimal number of letters/numbers .Good:
Demonstration

Technical problems
The tutorial was tested on PhpBB3 and works with every browsers; If you notice that the tutorial doesn't work for a browser or for a version of forum (PhpBB2, PhpBB3, PunBB, Invision) contact an administrator and we will fill this field with your segnalation. Thanks, the staff |
For every problem or question please, contact us in the section Support for the tutorials, The staff will answer you as soon as it is possible... |
Friendly,
The team of the Forum of Codes.
Last edited by Niko on Mon Apr 16, 2012 7:05 pm; edited 1 time in total