CharsCounter (and MaxLength) plugin
This is a simple plugin based on plugins submitted by
ctebah and xenden.
You can define an optional MaxLength parameter and an
optional external CounterName (a input type=text tag
placed in the same form of the textarea being
replaced), to dislplay the amount of charachters still
available.
You can also place a button called 'CharsCounter' to
display in the toolbar the current amount of
text/HTML/left chars (as in the ctebah's plugin)
For example:
<form name="myform" action=... method=...>
<textarea name="text_1" id="text_1"></textarea>
<input type="text" name="text_1_cnt" id="text_1_cnt"
value="255">
<script type="text/javascript">
var oFCKeditor_1 = new FCKeditor('testo_1');
oFCKeditor_1.BasePath = '../FCKeditor/';
oFCKeditor_1.Config['MaxLength'] = 255;
oFCKeditor_1.Config['CounterName'] = 'text_1_cnt';
oFCKeditor_1.ReplaceTextarea();
</script>
</form>
I tried to keep the code as clear as possible, using
the 'interface' provided by fredck, without rewriting
many functions again. It should be simple to add/modify
some features/behaviours as you require.
I tested thi splugin with the 2.2 version, on IE and FF
browsers.
Let me know what do you think of this plugin, any
suggestion will be appreciated!
gi_gio
---------
this is the same charcounter plugin but with fix for
the FCKEDITOR ver 2.3
I hope that other will follow me and post a fixed
plugins for VER 2.3
char counter(for ver2.3)
Logged In: YES
user_id=1549488
Cant get this to work. Is there an example using the PHP
class? Also adding to toolbar throws js alert.
Logged In: YES
user_id=1549488
Cant get this to work. Is there an example using the PHP
class? Also adding to toolbar throws js alert.
Logged In: YES
user_id=1356422
Originator: NO
This plugin was originally created here: https://sourceforge.net/tracker/index.php?func=detail&aid=1403818&group_id=75348&atid=737639 and there are several comments about how to use it and customize the way that it works.
Logged In: YES
user_id=1127417
Originator: NO
The toolbar buttom of this plugins print the label and dont work rigth, somebody have this problem too?... im using FCKeditor 2.3.1
Logged In: YES
user_id=1665661
Originator: NO
yes -- unfortunately, the button looks raw html: <label id="CharsCounterLabel">0 / 0 / *the Count* </label>.
I guess the reason is, that my FCK is integrated with jsp and no document.getElementbyId could be used. But I am a Newbie in this, so I am not sure.
Logged In: YES
user_id=1874854
Originator: NO
I am trying to implement your plugin, but im having a lot of trouble. I'd really appreciate it if you could give me a hint in the right direction (:
Here's what i've done so far:
1. Extracted the CharsCounter.zip to fckeditor\editor\plugins\CharsCounter ;
2. Implemented the editor in my code, with the following snippet:
_________
<textarea name="ses_messageText" id="fckeditor">
<xsl:value-of select="//HEADER/ses_messageText"/>
</textarea>
<input type="text" name="text_1_cnt" id="text_1_cnt" value="255"/>
<script type="text/javascript">
var sBasePath = 'site/js/fckeditor/' ;
var oFCKeditor = new FCKeditor( 'fckeditor' ) ;
oFCKeditor.ToolbarSet = 'Berichtwizard' ;
oFCKeditor.BasePath = sBasePath ;
oFCKeditor.Height = "350";
oFCKeditor.Config['MaxLength'] = 2;
oFCKeditor.Config['CounterName'] = 'text_1_cnt';
oFCKeditor.ReplaceTextarea() ;
</script>
________
It seems the FCKEditor isn't loading your plugin. I've added a simple alert(); to the plugin and i dont get a popup. Do you have any idea what im doing wrong? Thanks a lot in advance!
I have added the CharsCounter plugin to my FCKeditor installation, but the toolbar button isn't working. It displays:
<label id="CharsCounterLabel">0 / 0 / 10</label>
Does anyone have a suggestion?
Hi all,
Sorry... I am too late in this forum.
The work done by Tamir Mordo is goood.
I have made a few corrections to the plugin and now it works well.
Added these lines::
Line: 168
FCK.Events.AttachEvent( 'OnAfterSetHTML', CharsCounter_CheckEditorStatus ) ;
Line 56 :
updateToolbar(this.LeftChars);
Added this method from the original script
function updateToolbar(LeftChars){
if(!document.all && LeftChars != 0)
LeftChars++;
FCK.ToolbarSet.ToolbarItems.LoadedItems.CharsCounter._UIButton.MainElement.innerHTML = '<table cellpadding="0" cellspacing="0"><tbody><tr><td><img src="images/spacer.gif" class="TB_Button_Padding"></td><td class="TB_Button_Text" nowrap="nowrap">Left Chars:' + LeftChars + '</td><td><img src="images/spacer.gif" class="TB_Button_Padding"></td></tr></tbody></table>';
}
Please try this
Cheers
John
and Yes i modified line 97 to remove the html label content
var oCharsCounterItem = new FCKToolbarButton( 'CharsCounter', FCK.Config['MaxLength'] , 'Text length / HTML length / Left chars', FCK_TOOLBARITEM_ONLYTEXT, false, true ) ;
Hello everybody !
Thanks a lot to mjohnjoseph, i can tell you that it woks too on version 2.6.6
:-)