1 of 2
1
Extension: MD Character Count - display and limit the number of characters allowed for fields
Posted: 14 November 2008 11:22 AM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 14 November 2008 12:20 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9253
Joined  04-15-2006

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

 Signature 

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

Profile
 
 
Posted: 14 November 2008 12:22 PM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  462
Joined  10-10-2004

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

Profile
 
 
Posted: 14 November 2008 12:32 PM   [ Ignore ]   [ # 3 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

@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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 14 November 2008 12:55 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9253
Joined  04-15-2006

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

 Signature 

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

Profile
 
 
Posted: 18 January 2009 12:37 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  73
Joined  08-14-2007

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.

Profile
 
 
Posted: 18 January 2009 12:51 PM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 18 January 2009 01:06 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Rank
Total Posts:  73
Joined  08-14-2007

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

Profile
 
 
Posted: 28 January 2009 08:16 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 03 March 2009 12:49 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  317
Joined  09-06-2006

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

 Signature 

Kyle Summer | smartpill design | New Haven, CT |  twitter

Profile
 
 
Posted: 03 March 2009 12:52 PM   [ Ignore ]   [ # 10 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 17 March 2009 05:13 PM   [ Ignore ]   [ # 11 ]  
Summer Student
Total Posts:  16
Joined  11-04-2008

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

Profile
 
 
Posted: 17 March 2009 10:10 PM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 23 April 2009 01:35 PM   [ Ignore ]   [ # 13 ]  
Grad Student
Avatar
Rank
Total Posts:  35
Joined  09-02-2007

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

File Attachments
notices.html  (File Size: 11KB - Downloads: 24)
 Signature 

 

Profile
 
 
Posted: 23 April 2009 01:57 PM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2021
Joined  03-26-2006

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.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 23 April 2009 02:06 PM   [ Ignore ]   [ # 15 ]  
Grad Student
Avatar
Rank
Total Posts:  35
Joined  09-02-2007

That fixed it for me Ryan. Thanks a lot.

 Signature 

 

Profile
 
 
Posted: 28 April 2009 09:49 AM   [ Ignore ]   [ # 16 ]  
Grad Student
Rank
Total Posts:  83
Joined  07-03-2008

Just wanted to say thanks for this extension - works perfectly. Cheers!

Profile
 
 
Posted: 30 April 2009 07:13 AM   [ Ignore ]   [ # 17 ]  
Lab Assistant
RankRank
Total Posts:  263
Joined  01-20-2006

Hey Ryan, any chance this could be made to work on the title field as well in the future?

 Signature 

buro taggetig: web design & event photography from Belgium.  |  Follow me on Twitter

Profile
 
 
Posted: 09 May 2009 02:45 PM   [ Ignore ]   [ # 18 ]  
Grad Student
Avatar
Rank
Total Posts:  87
Joined  10-17-2007

In case anyone gets a similar problem, I was getting this error when trying to save the settings:

Notice: Undefined index: field_defaults in / ...path to… /extensions/ext.md_character_count.php on line 443

And a few other errors - the settings were still saved though.  As this was the first time I’d used the extension, I hadn’t realised that there were parts missing from the settings page.  Line 443 refers to $_POST[‘field_defaults’], which didn’t exist, hence the error crashing the Control Panel.

Adding:

if (isset($_POST['field_defaults'])) {

before the foreach line (443) removed the error.

The reason it was occuring was that I’d tried to access the extension too early!  Although I had some weblogs, I hadn’t set up any fields yet, and the extension doesn’t check for this.

What would be handy is adding the above if statement to the extension code to prevent the error appearing and when loading the settings page, display a message if no appropriate text fields were found in the weblogs informing the user.

Profile
 
 
   
1 of 2
1
 
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 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77543 Total Logged-in Users: 37
Total Topics: 101543 Total Anonymous Users: 29
Total Replies: 544335 Total Guests: 257
Total Posts: 645878    
Members ( View Memberlist )