Page 1 of 1

Trouble with Limiting Comment Textbox Size

Posted: Tue Oct 09, 2007 2:37 pm
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.

Posted: Tue Oct 09, 2007 3:58 pm
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