Thread

Extension: MD Character Count - display and limit the number of characters allowed for fields

November 14, 2008 1:22pm

Subscribe [14]
  • #1 / Nov 14, 2008 1:22pm

    Ryan Masuga

    1511 posts

    For my current project, I needed a more robust character count that was was out there, so I started by looking at what Andrew Weaver had done with his, and came up with this offering.

    MD Character Count will show character counts below textareas, text inputs, and MD Markitup fields in the CP. You can set character counts to “soft” (which is the default) which is more of a suggestion, or “hard” which will limit the field to that many characters and no more. You can also customize the message underneath each field.

    You can download it from the MD Character Count page at Masuga Design.

  • #2 / Nov 14, 2008 2:20pm

    Mark Bowen's avatar

    Mark Bowen

    12420 posts

    Hi Ryan,

    Will post here as well as your site to say this is an excellent little extension well done and thanks for sharing it!!

    Just one thing though I couldn’t seem to get this to work unless I enabled the jQuery For Control Panel extension. I thought from reading the documentation that it should work without it but couldn’t seem to get it to work like that. Works great though with the other extension on so thanks.

    Best wishes,

    Mark

  • #3 / Nov 14, 2008 2:22pm

    Rob Quigley's avatar

    Rob Quigley

    236 posts

    This is really great. Just a feature request: it would be great if there was an option to count words instead of characters. I know I could use the word counter. smile

  • #4 / Nov 14, 2008 2:32pm

    Ryan Masuga

    1511 posts

    @Mark: I would suggest always turning on the CP jQuery extension. If other extensions are written to look for this, it will help avoid conflicts.

    This extension should definitely work without having to install CP jQuery, but it might not depending on whether you have other extensions installed that are also calling jQuery. If those others are older and not set up to look for other extensions also calling jQuery (like this one), sometimes jQuery can be loaded more than once in the head which can cause some extensions to fail. I’ve seen some of Leevi’s extensions fail because of this too (LG Data Matrix, in my testing). That’s the sort of the thing the CP jQuery extension was intended to help address.

    @Rob: Word count would be nice, sure. And so would being able to ignore HTML. I’m not married to the jQuery plugin I’m using - it seemed lightweight, but I did have to modify it to allow for soft counts. If there is a better character/word counting jQuery extension out there, point me to it and maybe I can beef this up with some extra settings.

  • #5 / Nov 14, 2008 2:55pm

    Mark Bowen's avatar

    Mark Bowen

    12420 posts

    Hi Ryan,

    Ah right. Could possibly be another extension then although to tell the truth I don’t think any of the other extensions I have on the site use jQuery. Could be wrong on that though.

    Anyway will just go with using the jQuery extension as that is much neater anyway.

    Again thanks for a fantastic extension, really nice this one!! wink

    Best wishes,

    Mark

  • #6 / Jan 18, 2009 2:37pm

    ABDC

    71 posts

    I know your specs state that the plugin is MSM aware,

    however when I change from site to site I get an error in my page above all HTML :

    Notice: Undefined index: 2 in /www/htdocs/cebuco/http/system/extensions/ext.md_character_count.php on line 110

    Where index 2 is the index of the site.

    I used both the custom path for jquery, and when I encountered the problem the CP jquery extention. But that made no difference.

    Any idea what can cause this? Thank you.

  • #7 / Jan 18, 2009 2:51pm

    Ryan Masuga

    1511 posts

    Let’s make sure we’re on the same page. What version/build of EE are you using, and are you using PHP 4 or 5?

  • #8 / Jan 18, 2009 3:06pm

    ABDC

    71 posts

    I am using EE 1.6.6 and PHP Version 5.2.6-5 Version 1.0.4 of your extention

  • #9 / Jan 28, 2009 10:16am

    Ryan Masuga

    1511 posts

    I’m setting up an MSM installation locally to test this and MD Live Search. Seems a few of my add-ons are having issues with their MSM abilities. Arrrgh.

  • #10 / Mar 03, 2009 2:49pm

    smartpill's avatar

    smartpill

    454 posts

    Here’s a jQuery word count plugin I found. I need it for a SAEF, but might have something useful for the extension.

  • #11 / Mar 03, 2009 2:52pm

    Ryan Masuga

    1511 posts

    Cool. I think it would be a good thing to specify whether you want words or characters counted on each field. The other nice thing would be to ignore HTML tags.

  • #12 / Mar 17, 2009 8:13pm

    Garrett

    36 posts

    Ryan, any progress with the MSM undefined index errors? I am seeing the same errors when switching between sites:

    Notice: Undefined index: 1 in /[path]/extensions/ext.md_character_count.php on line 96

  • #13 / Mar 18, 2009 1:10am

    Ryan Masuga

    1511 posts

    I haven’t fixed that. I think the only thing you need to do is go into the MDCC settings for that site and hit “Submit” once and that error should go away.

    I would get on this, but I think the above will solve the issue for each site for now, and I have a certain EE-related site I’m trying to get launched as soon as possible. It’s on my to-do list, though.

  • #14 / Apr 23, 2009 4:35pm

    Wes Baker's avatar

    Wes Baker

    343 posts

    I’m seeing notices as well and If it would help I’ve attached a dump from xdebug of the notices I’m seeing.

  • #15 / Apr 23, 2009 4:57pm

    Ryan Masuga

    1511 posts

    I’m almost 100% positive this has to do with the settings not getting set by default - hence having to hit “Submit” to get the settings in there. With a launch of devot:ee coming very soon I just don’t have time to get on this immediately. It’s still on my to-get-to list.

    Thanks for posting the notices.

ExpressionEngine News

#eecms, #events, #releases