Limiting characters within comments
Posted: 02 July 2009 08:01 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-24-2006

Hi,

Is there an easy way to limit the amount of characters someone can type within a textarea when submitting a comment?

Thanks,

Andy

Profile
 
 
Posted: 02 July 2009 08:14 AM   [ Ignore ]   [ # 1 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10694
Joined  04-15-2006

I haven’t seen one but I reckon you would probably need to use some Javascript on the textarea to prevent people from typing past a certain limit. That said if they turned off Javascript then the full post would still get submitted so you would still probably need to have some extension which would then limit what has been submittted. You would of course need to warn people that if they did have javascript turned off then their message would get automatically truncated after so many characters. The extension could start to get quite complex though as people might have a web link in the comment which would then if it were at the end of the comment seemingly knock over the amount of allowed characters even though the word used as the link might be quite short. You could also end up with half a link or something like that.

Not exactly an easy thing to create although not entirely impossible either although I haven’t seen anything around that directly does that sort of thing, sorry.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 02 July 2009 08:31 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-24-2006

Thanks, as always, for your quick and helpful reply, Mark. I’ll look into using some Javascript voodoo.

Cheers,

Andy

Profile
 
 
Posted: 02 July 2009 08:57 AM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10694
Joined  04-15-2006
Antenna - 02 July 2009 08:31 AM

Thanks, as always, for your quick and helpful reply, Mark. I’ll look into using some Javascript voodoo.

Cheers,

Andy

There are probably quite a few already built out there which you can probably just drop into your page head tag and they will just work so I’d just do a quick Google as I’m sure some will turn up right away.

Someone else in here might have a better idea though or even a solution already custom made so if they do hopefully they will share it in here.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 02 July 2009 09:07 AM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1873
Joined  10-22-2006

Well, you can set the Maximum number of characters allowed in comments on a per-weblog basis under CP Home ›  Admin ›  Weblog Administration ›  Weblog Management ›  Edit Weblog Preferences ›  Comment Posting Preferences

When they cross the limit they get a message and can return to the previous page. So you can indeed reliably force a maximum.

A character countdown like here in the forum is a nice though which would require at least some JS in the template.

 Signature 

utilitEEs - Addons for EE

Profile
 
 
Posted: 02 July 2009 09:16 AM   [ Ignore ]   [ # 5 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10694
Joined  04-15-2006
silenz - 02 July 2009 09:07 AM

Well, you can set the Maximum number of characters allowed in comments on a per-weblog basis under CP Home ›  Admin ›  Weblog Administration ›  Weblog Management ›  Edit Weblog Preferences ›  Comment Posting Preferences

When they cross the limit they get a message and can return to the previous page. So you can indeed reliably force a maximum.

A character countdown like here in the forum is a nice though which would require at least some JS in tzhe template.

Oops trust me for posting too quickly. Was just about to come back and post my mistake. Thanks for putting me right on that one.

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 02 July 2009 09:36 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  03-24-2006

Thanks silenz - I’ve now used that Comment Posting Preferences setting in conjunction with a nice little jQuery plugin that counts down the characters as you type.

All’s working fine!

Profile
 
 
Posted: 28 October 2009 01:32 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  96
Joined  07-20-2006

What is the character limit on comments? Is it 2^16?

Profile
 
 
Posted: 28 October 2009 02:17 PM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  96
Joined  07-20-2006

I see from phpMyAdmin that the field type is “text” so I’ve got the answer to my own question. smile

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 02:47 PM
Total Registered Members: 119539 Total Logged-in Users: 72
Total Topics: 125770 Total Anonymous Users: 44
Total Replies: 661801 Total Guests: 434
Total Posts: 787571    
Members ( View Memberlist )
Newest Members:  nottRobinKendpkitoyfr1arHomer Landisrogersgoldminesaricflan344Polzmejustulike