I've been playing with this bit of code within the default.php of this plugin:
public function PostController_Render_Before($Sender) { $this->_WordCounter($Sender); } public function DiscussionController_Render_Before($Sender) { $this->_WordCounter($Sender); }
It looks correct, but doesn't display the Word Count on the new discussion form. I have absolutely no clue why.
I've been looking at that piece of code and not understanding why it doesn't work as the form name, even for q&a, is still "discussion".
I've even tried disabling Q&A just to see if it works without, uninstalling/reinstalling ButtonBar and Count Words, switching to default theme, but no luck.
var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm");
it is looking for** class** not id
so try changing it to this add the id
var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm, #DiscussionForm");
report back.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Comments
Sweet, thanks for the verification @aery! Glad you could use the plugin!
Kasper Kronborg Isager (kasperisager) | Freelance Developer @Vanilla | Hit me up: Google Mail or Vanilla Mail | Find me on GitHub
I'm using ButtonBar and Vanilla 2.0.18.4 and WordCount works perfectly when adding a comment to a posted question (I'm also using the Q&A plugin)
But when composing a new question it does not appear. I've included two screenshots that display what I am talking about:
I've been playing with this bit of code within the default.php of this plugin:
public function PostController_Render_Before($Sender) { $this->_WordCounter($Sender); } public function DiscussionController_Render_Before($Sender) { $this->_WordCounter($Sender); }
It looks correct, but doesn't display the Word Count on the new discussion form. I have absolutely no clue why.
var forms = $(".DiscussionForm, .CommentForm, .EditCommentForm");
whats the name of the form in qna?
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
<form id="Form_Discussion" method="post" action="/post/discussion">
I've been looking at that piece of code and not understanding why it doesn't work as the form name, even for q&a, is still "discussion".
I've even tried disabling Q&A just to see if it works without, uninstalling/reinstalling ButtonBar and Count Words, switching to default theme, but no luck.
And what do you see in jquery.wordcount.js
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Just deleted code I pasted here
b/c your fix on line 6 above worked perfectly. Just needed to add
#DiscussionForm
Thank you @peregrine!!!!!