Trouble with Limiting Comment Textbox Size

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
drwillennium
Posts: 6
Joined: Sun Sep 03, 2006 5:27 pm

Trouble with Limiting Comment Textbox Size

Post by drwillennium »

Script URL: http://www.pleasantstreetinnbb.com/php/ ... /gbook.php
Version of script: 1.43
Hosting company: godaddy
What terms did you try when SEARCHING for a solution: maxlength


I am having trouble with gbook spam, and I know the number one thing I should do to fix it is to upgrade to version 1.5. However, I will not have time to do that for another month or two. So to put a minor fix on it, I was going to limit the size of the message that can be entered. Currently is it unlimited, and the spammers take full advantage of this and enter page long entries. I added the code

Code: Select all

 maxlength="800" 
to line 732. The new section of code then looks like this

Code: Select all

<p align="center"><b>Comments:</b><br>
<textarea name="comments" rows="9" cols="50" maxlength="800"><?php echo $comments; ?></textarea>
My issue is, of course, is that this does not work and does not limit the text field at all. Any idea as to why its not working? I was hoping that it would be a quick fix until I have time to upgrade, but maybe it wont be.
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

As far as i know the maxlength function does not work in textarea, just in <input type="text" maxlength="50" />

You can solve your problem by adding some javascript.
Take a look here http://www.dynamicdrive.com/dynamicinde ... length.htm

Greetings,
Henrie
Post Reply