Show alert/confirmation if post is too short
From PunBB Resource Wiki
Contents |
[edit]
What it does
This small modification adds the possibility to specify a minimum length for posts.
[edit]
How to make it work
[edit]
Using an alert
- Open header.php
Find:
if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='') { alert("\"" + element_names[elem.name] + "\" is a required field in this form.") elem.focus() return false }
Replace with:
if(elem.type == "textarea" && elem.value.length < 8) { alert("Your message should be at least 8 characters long!"); return false; } else { if (elem.type && (elem.type=="text" || elem.type=="textarea" || elem.type=="password" || elem.type=="file") && elem.value=='') { alert("\"" + element_names[elem.name] + "\" <?php echo $lang_common['required field'] ?>") elem.focus() return false } }
[edit]
Using a confirmation box
With this, a user can still post but just gets a warning
Replace:
alert("Your message should be at least 8 characters long!"); return false;
With:
return confirm("Your message is shorter than 8 characers. Do you still want to submit?");

