Author |
Message |
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 17/05/2006 21:02:00
|
fmon
Beginner
Joined: 17/05/2006 20:56:50
Messages: 11
Offline
|
I have searched for an answer but wave not found one. How can I set a maximum length for a comment in advnced poll. I know some inputs to a form take a maxlength=x but the textarea does not. Is there some PHP change I can do? Is there one built in? Limiting message length would help with spam etc.
thanks
Frank
|
|
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 18/05/2006 23:16:46
|
fmon
Beginner
Joined: 17/05/2006 20:56:50
Messages: 11
Offline
|
I Think I have found an answer here, a js for the form that limits input to a textarea
http://javascript.internet.com/page-details/limit-characters-and-lines.html#source
|
|
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 18/05/2006 23:56:09
|
fmon
Beginner
Joined: 17/05/2006 20:56:50
Messages: 11
Offline
|
This is better
http://javascript.internet.com/forms/limit-textarea.html#source
|
|
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 13/06/2006 21:09:04
|
justme
Newbie
Joined: 13/06/2006 21:02:45
Messages: 1
Location: Vancouver,Canada
Offline
|
any idea where this script should be pasted?
comment.php?
thanks
|
|
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 13/06/2006 22:28:32
|
Carbonize
Master
![[Avatar]](/forum/images/avatar/96871336492d73e733f55.jpg)
Joined: 12/06/2003 19:26:08
Messages: 4292
Location: Bristol, UK
Offline
|
Put it at the top of form.php
|
Carbonize
I am not the maker of the Advanced Guestbook
get Lazarus |
|
![[Post New]](/forum/templates/html/images/icon_minipost_new.gif) 16/06/2006 05:19:27
|
fmon
Beginner
Joined: 17/05/2006 20:56:50
Messages: 11
Offline
|
I did the following, in the template for comments, i didn't bother with a counter, just a reminder to limit maximum lenght. In the textarea I put:
You could put the stuff in a function and provide a counter as in the examples in the links above. I tried to put the substring function in an "onsubmit" in the form tag but it did not work, anyone know why?
You also need to do something on the server side to prevent hacking around the html, I did this in comments.php after name and message are checked for input.
I am limiting message length to 1000 characters. So far seems to work well.[/code]
|
|
|