Closed (fixed)
Project:
Facebook-style Statuses (Microblog)
Version:
6.x-2.0-rc1
Component:
Documentation
Priority:
Minor
Category:
Task
Assigned:
Reporter:
Created:
13 Jul 2009 at 18:37 UTC
Updated:
17 Mar 2010 at 06:44 UTC
The character count displays NaN when you type into the status area. Looks like the javascript inside facebook_status.js is messed up. Maybe we should modify it and use something like this. http://www.moofburger.com/blog/limit-textarea-input-with-jquery#example
(function($) {
/**
* $.fn.textLimit
* Sets a limit on elements matched by selector and reports the
* difference between input and the max length on elements matched
* by targetSelector
*
* Usage:
* $(selector).textLimit(limit, targetSelector);
*/
$.fn.textLimit = function(len, target) {
$(this).keyup(function() {
var charLength = $(this).val().length;
$(target).html(charLength + ' of ' + len + ' characters used');
if(charLength > len) {
$(target).html('You may only have up to ' + len + ' characters.');
}
});
}
})(jQuery);
Comments
Comment #1
icecreamyou commentedSee also #510160 NaN characters remaining.
The JQuery in facebook_status.js is much better than the code you posted, and it takes almost the same approach.
The JavaScript inside facebook_status.js is not messed up. If you've installed the module correctly and you don't have any modules installed that explicitly interfere with FBSS, the JQuery in FBSS works in every major browser. Your issue is probably due to an installation/upgrade error. You should clear your Drupal cache completely (run update.php, or use admin_menu or devel if you have either one installed) as well as your browser cache.
In addition, JavaScript is a client-side language. That means it's completely useless to report a JavaScript-related bug unless you also provide in which browser(s) and OS(s) you experienced the problem, and also mention if you have any JavaScript-related modules installed (such as JQuery Update).
Comment #2
gooddesignusa commentedSorry the initial post was lacking the proper information for your to troubleshoot.
So today I uninstalled the module. deleted the directory. uploaded the new one and turned it on. Checked on safari, ff 3.5 on mac, ff 3 on pc, ie6 , ie7. Still getting NaN. Should of mentioned in the first post that as soon as you click on the input box on the user profile page the counter reads : "192,192 characters remaining". Only after you type something does it change to NaN.
After messing around with my Block settings I noticed I had the "Facebook-style Statuses" block turned on. After turning that block off the character counter worked on the profile page. I still wanted to use that block so as a work around I installed the me aliases module. Then i just set it up to not show up on the "user/me" page.
Thanks again for this awesome module and speedy reply.
Without it the site I'm working on would be very boring / hard to pitch.
Comment #3
gooddesignusa commentedWell that work around doesn't totally work since the "Facebook-style Statuses" block still shows up on other users pages. Which causes the counter to not work again.
Comment #4
icecreamyou commentedAhhhh. As The Captain1 would say, "What we have here is failure to communicate." Although it's obvious to me as the person who wrote the module, it's clearly not obvious to anyone else that the JavaScript for a form only works if the form appears only once on that page. For your reference, by default the form appears on user pages, at
/share-status, and at/statuses/conversation.I'll document this somewhere and/or add a warning in the module before the next stable release.
1 From the movie Cool Hand Luke.
Comment #5
JNeoN commentedHi.
I've overriden the user's profile and I inserted this snipped I read from you in another issue:
echo theme('facebook_status_form_display', user_load(array('uid' => arg(1))), variable_get('facebook_status_size_long', 40), 'facebook_status_recent');The problem is that when I put a stasus, It refreses well at 'facebook_status_recent'.
If I want to put a new status appears: "192,192 characters remaining" and If I write something in the status appears "NaN characters remaining". Its normal ?
Comment #6
icecreamyou commented@JNeoN: Read #4 and the documentation.
Comment #7
icecreamyou commentedAdded documentation here and in the block configuration settings. Also set the default visibility settings to show on all pages except "share-status" (I didn't include user/* because the user profile is commonly altered).
Comment #9
mmachina commentedI also find that the NaN characters problem appears when Advanced Profile Kit is turned on... I turned on the advanced users panel from the panels administration page and then received the NaN characters remaining... I turned it off and immediately it returned to normal. Any idea on how to fix this problem?
Thanks in advance.
Comment #10
icecreamyou commentedmmachina, this was fixed in #652748: NaN characters remaining in Panels on User Profiles and is documented here. You should upgrade to the latest development build and run update.php after upgrading.
Although I appreciate that you took the time to search for existing issues before opening your own, in the future please do not reopen closed issues on outdated versions of a module.