The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Word count mod - Ajax
Hey guys,
Is there a way to count the current amount of words typed in the message box and calculate how many characters remain untill the word limit is reached? You can see an example here: http://www.newgrounds.com/bbs/post/reply/914240 James |
#2
|
||||
|
||||
AJAX is not needed. JS is all that is required. I'm sure there are many tutorials on the net that will tell you have to get this counter.
|
#3
|
||||
|
||||
Hi,
Ive been trying to do this but have come across some difficulties. First of all here is my code to count the characters: Quote:
Quote:
Now i went to my editor_clientscript template and added the javascript with the rest of the javascript, this is what i added: Quote:
Can anyone tell me what the problem is? Ive tried to do it myself a few times but i really cant figure it out. I can provide any more information if it will help. James --------------- Added [DATE]1212254583[/DATE] at [TIME]1212254583[/TIME] --------------- Ive just tested the code as it was originally posted and it works fine so im having a really hard time finding out why it isnt working. Ive also tried pasting the code at the top of the editor_toolbar_off template with the other javascript and it doesnt work there either :'( |
#4
|
||||
|
||||
Bump, i still cant figure this out and would really appreciate some help.
Regards, James |
#5
|
||||
|
||||
Remove the below in red:
Code:
<div class="controlbar" style="text-align:$stylevar[left]"> <form name="ccform"> <textarea name="message" id="{$editorid}_textarea" rows="10" cols="60" style="width:$stylevar[messagewidth]; height:60px" tabindex="1">$newpost[message]</textarea> <p><input type="text" name="display" /></p> </form> </div> Code:
<script language="JavaScript"> var running = false; function start(){ running = true; setTimeout('run();',500); } function run(){ document.vbform.display.value = document.vbform.message.value.length; if(running) setTimeout('run();',100); } function stop(){ running = false; } </script> |
#6
|
||||
|
||||
Thank you for the help. I made the adjustments that you suggested:
At the start of my editor_clientscript i have this javascript: Quote:
Quote:
|
#7
|
||||
|
||||
I too have tried many variants of the code but it appears that due to the nature of the vBulletin text editor, it doesn't seem to register it as 'message' for the name but rather something else, or nothing at all. Unless you can find another way to call the actual text area of the editor then it won't be able to count the text.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|