Jump to content


Limit Characters in Shoutbox


  • You cannot reply to this topic
No replies to this topic

#1 visiblesoul

  • Administrators
  • 551 posts
  • Location:Earth
  • Texas

Posted 06 September 2004 - 12:39 PM

HOW TO LIMIT CHARACTERS PER POST IN MKPORTAL SHOUTBOX


This method works in Mozilla Firefox 0.9.3 and IE 6. It is a javascript method based on a script from this page:

[url="http://www.mediacollege.com/internet/javascript/form/limit-characters.html"]http://www.mediacollege.com/internet/javas...characters.html[/url]

I haven't tested it very thoroughly but it worked on my test site and it worked for other webmasters. I don't think it will interfere with any of the MKPortal javascript functions but I'm not making any guarantees. Of course if your users disable javascript it won't work. Backup your files before you make changes.


FIND in /mkportal/modules/urlobox/index.php:
[quote][/quote]
REPLACE WITH:
[quote]



(Maximum characters: 50)

You have 50'> characters left.
[/quote]
Replace the occurences of the number "50" in red with the number of characters that you want to allow.


FIND: /mkportal/templates/*/tpl_main.php (function view_header):
[quote]<script language="JavaScript" type="text/javascript" src="{$js}">[/quote]
ADD BELOW:
[quote]<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
  limitField.value = limitField.value.substring(0, limitNum);
} else {
  limitCount.value = limitNum - limitField.value.length;
}
}
[/quote]


-=DKC=-


Please note that I offer free support on this forum in my free time. Depending on how much work I have backlogged it may take me a week or more to answer questions. I am not ignoring you. I answer everyone but please be patient. Thanks.

Disclaimer: All forum posts, including code examples, on this forum are offered for free in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Use code examples at your own risk.

"If at first you don't succeed, keep on suckin' til you do succeed." -Curly Howard





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users