If you are not registered or logged in, you may still use these forums but with limited features. Show recent topics
  [Search] Search   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [FAQ]  FAQ 
[Register] Register / 
[Login] Login 
Limiting message length in comments - Advanced Poll  XML
Forum Index » Support Forum
Author Message
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
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
fmon
Beginner

Joined: 17/05/2006 20:56:50
Messages: 11
Offline

This is better

http://javascript.internet.com/forms/limit-textarea.html#source
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
Carbonize
Master
[Avatar]

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
[Email] [WWW] [Yahoo!] aim icon [MSN] [ICQ]
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]
 
Forum Index » Support Forum
Go to:   
Based on the open source JForum