Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Limit Length of Comments?
Is there a way to limit the number of characters that a visitor can enter into the message field?
Offline
Re: Limit Length of Comments?
I believe so. You’ll need to hack your comments.php file, though.
Open it up and find this line (around Line 121):
$textarea = '<textarea class="txpCommentInputMessage" name="message"'.$msgcols.$msgrows.$msgstyle.' tabindex="4">'.htmlspecialchars($message).'</textarea>';
Change it to this:
$textarea = '<textarea class="txpCommentInputMessage" name="message"'.$msgcols.$msgrows.$msgstyle.' tabindex="4" maxlength="xxx">'.htmlspecialchars($message).'</textarea>';
Adding the maxlength="xxx"
attribute should limit the number of characters that can be entered into the field. Of course, change xxx
to the number of characters you wish to limit the field to.
Last edited by jaredigital (2005-10-21 22:38:08)
Offline
Re: Limit Length of Comments?
There is no maxlength for textarea. You have to use either Javascript (which will only work if users have Javascript enabled – ;)), or you have to (have someone) write a plugin that intercepts the comment and does the necessary things (like changing submit to preview, and adding a message etc.).
Offline
Pages: 1