vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Real-Time counter in textboxes (https://vborg.vbsupport.ru/showthread.php?t=64975)

DivisionByZero 05-10-2004 10:37 PM

Real-Time counter in textboxes
 
1 Attachment(s)
Want your users to see how many characters they have left in a big textbox? Just add this two step hack and voila!....

Here's a screenshot:

Boofo 05-10-2004 10:55 PM

Any way to do this for the message box like newreply, newthread and editpost?

DivisionByZero 05-10-2004 11:16 PM

Yes, just add the script code to the header of the page that will be served, and add the code appropriately for any textarea or textbox.

AN-net 05-11-2004 02:00 AM

would it still work if we disabled the textbox?

Boofo 05-11-2004 04:56 AM

Quote:

Originally Posted by ThePowerPig
Yes, just add the script code to the header of the page that will be served, and add the code appropriately for any textarea or textbox.

Can you please tell us how to add it to the textarea of a message? And will it work accurately with the WYSIWYG editor?

Phalynx 05-11-2004 08:05 AM

nice one, thanks

gmarik 05-11-2004 10:59 AM

Great one!

GamerJunk.net 05-11-2004 01:03 PM

Good job.

DivisionByZero 05-14-2004 04:00 AM

I do not know if it will work with WYSIWYG, in fact, i doubt it if it's not a standard textarea, and i don't know much about WYSIWYG so it may add the text formatting tags as well. That's a whole new agenda lol

Ok, quick tutorial. I'm assuming you all know how to add the header code in each page served that this functionality will appear on, so we'll move on:

The first thing you need to know is that EACH counter/textarea relationship MUST have it's own unique identifier. This means that each textarea should have a unique "name". Real forms do this anyway so you shouldn't have to worry.

So, to add this functionality to any textarea, you will need to modify the "textarea" tag according to the following example configured to allow 125 characters maximum
PHP Code:

<textarea class="bginput" name="MYFORMNAME" cols="28" rows="4" onKeyDown="textCounter(MYFORMNAME,this.form.remLen,125);" onKeyUp="textCounter(MYFORMNAME,this.form.remLen,125);"

And finally, to populate the counter and make it work ONLY with its corresponding textarea, modify it like this:
PHP Code:

<input readonly class="bginput" name="remLenMYFORMNAME" size="4" value="125"

That should be it :)

Carter876 05-17-2004 12:16 PM

Sorry but I haven't understand, if I would to count the number of characters in Newthread and in newpost what I can do?
What code I must to insert and where?

Tnx in advance :)

Regards


All times are GMT. The time now is 04:59 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01163 seconds
  • Memory Usage 1,737KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete