Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

CountCharacters

edited June 2009 in Vanilla 1.0 Help
CountCharacters

Comments

  • I have problems with the extension: -It doesn't show the remaining number of characters and -as I exceed max_comment_length, nothing happens and is the default Vanilla who stops publishing the comment. I don't know much about javascript to say if it's right or not :(
  • I've tried this on a new Vanilla install where it works and on an old one where it doesn't work. Obviously, there is a conflict with one of the 50 extensions I have activated. I will try to find the cause. Maybe you don't have as many as I and can email or whisper to me the extensions you have activated. I would appreciate it.
  • I see that a few of you have downloaded this extension. Is it working for you? There does seem to be a problem with other javascript that might be loaded, but I haven't been able to really identify the problem. If anyone does have a problem, please contact me as I would appreciate it.
  • I have used it but decided against it again a bit later as I didn't like how the resulting submit button looked :) Is there any way to make it work without having to replace the normal submit button?
  • or make it so you can no longer type in the textbox (example: youtube comments)
  • @slartie: I am not replacing the Submit button but only hiding it and making it visible. Can you send me a screeshot of what you are talking about? Also, what theme/style are you using?

    @fysicsluvr: I can look into that.

    Thank you both for your comments.
  • I am using Vanilla Default. This is what my comment form looks like with CountCharacters enabled:

    image

    Maybe I'm just being a nitpick, but I'd really like to retain the original submit button.

    I'm on Windows Vista, FireFox 2.0.0.12.
  • I guess I should have tested the ability (or not) of Vanilla to actually handle a comment that was longer than the max value set. To me, Vanilla handles that fine and tells you how many characters you are over. So, to help you count the characters, I think this extension will be useful.

    To eliminate the hiding and showing of the button, please comment out the following lines in the functions.js file:
    if (q > maxvalue) { CharCount.style.fontWeight = 'bold'; CharCount.style.color = '#ff0000'; //button[0].type = 'hidden'; } else { CharCount.style.fontWeight = 'normal'; CharCount.style.color = '#000000'; //button[0].type = 'visible'; }
    There really isn't any need to do this since Vanilla traps the error. I will fix this.
    The delete and backspace keys actually adjust the count correctly.

    However, there is a discrepancy between what Vanilla says is the number of characters over the limit and what my count is. For example, my count says 400 characters over the limit while Vanilla says 518 characters. Maybe it has to do with end-of-line characters. I'll look into this.

    Edit: It does appear that Vanilla adds 2 characters per line (perhaps it's adding or counting a CR and LF for each line). That's what is the difference in counts.
  • Thanks for that.

    Would it be possible to move the counter up to the right of the whisper field? It would take up less screen real-estate and quite often, the bottom of the comment section won't be completely visible when you type in a new comment. You'll have to scroll down to see the counter and indeed the submit button.
  • I've played around with moving the counter. This is the best I can do.
    update

    I should have noted that if you want to do this, change the following function in the default.php file from a p tag to a div tag with an added style:
    function CommentForm_AddCount(&$CommentForm) { global $Context; echo '<div id="charsleft" style="float:right;clear:both;"><input disabled type="text" value=" Characters left -->" size="18"/><input type="text" name="charcount" id="char_count" size="8" /><input type="hidden" id="maxlength" name="maxlength" value="'.$Context->Configuration["MAX_COMMENT_LENGTH"].'" /> '; echo '</div>'; }
  • I noticed that the count does not work when a GUI editor (FCKEditor or TinyMCE - I forget which) is being used for the comments. There are similar issues with the 'quoting' extensions - they just don't know when there is a GUI editor in place of the standard textarea comment box.

    Is there an easy way to get it to work with the editor, or at least to not display if there is an editor in operation (since some users may use the GUI editor and some may not).

    -- Jason
  • Version number changed from 1.0.0 to 1.0.1.
  • Well, I tried to upload a new version that only works with the Text editor by got an error:

    The file you attempted to upload (CountCharacters101-20090207.zip) was of type "application/octet-stream", but the file extension "zip" did not match the accepted extensions for this type of file: rar, tar.gz

    Can anyone help me get past this error?
  • Found a bug in this extension: the javascript checks if there is enough space available, and if it is it sets the button type to "visible". This is wrong, and that's the reason the button changes "style" as Slartie mentioned: it actually becomes a text field! (try it: tab into it and then press space: you can write in it).

    The correct setting for the submit button type when active is (unsurprisingly) "submit".

    file: functions.js
    row: 45

    WRONG:
    button[0].type = 'visible';

    RIGHT:
    button[0].type = 'submit';


    Cheers! And keep up the good work.
  • Hi,

    I tried running the udpate for 'CountCharacters' and it said that an updated version of 'CountCharacters 1.0.1' is available. But I am unable to download it even after multiple attempts.

    Thanks
    Gerry
  • I'll try to work on this today.
  • Version number changed from 1.0.1 to 1.0.2.
  • Uploaded version 1.0.2 of CountCharacters.
Sign In or Register to comment.