Print Page | Close Window

textarea character counter

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Rich Text Editor (RTE)
Forum Description: Support forum for the Web Wiz Rich Text Editor (RTE).
URL: https://forums.webwiz.net/forum_posts.asp?TID=18125
Printed Date: 29 March 2026 at 10:25am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: textarea character counter
Posted By: fwsteal
Subject: textarea character counter
Date Posted: 25 January 2006 at 2:58pm
How do I get a textarea character counter to work on this tool via JavaScript?
 
I've tried several methods and nothing seems to work with this tool.
 
Any ideas?



Replies:
Posted By: WebWiz-Bruce
Date Posted: 25 January 2006 at 3:00pm
It would probaly be very difficult as an Iframe is layed over the top of the original text area, coupled with HTML to format the text, I wouldn't have thought it would be very acurate.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: fwsteal
Date Posted: 25 January 2006 at 3:10pm
is there a way onsubmit to have javascript count the values in the string prior to sending the form data for processing? if greater than 5 characters bounce back or let the page continue processing?
 
otherwise I guess I need to count the characters on the asp processing page.


Posted By: WebWiz-Bruce
Date Posted: 25 January 2006 at 3:40pm
You can do, using an onSubmit event that counts the value of the original textarea.

-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: fwsteal
Date Posted: 25 January 2006 at 4:50pm
I'm not a javascript guy so how would it be handled?


Posted By: WebWiz-Bruce
Date Posted: 25 January 2006 at 5:24pm
Sorry I am very pushed for time so don't have time to look into it for you,

Maybe someone else can help you, or have a look on Google for some JavaScript tutorials.


-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: fwsteal
Date Posted: 26 January 2006 at 3:02pm
I've got several examples in Javascript that work fine outside this tool; since this tool lays an iframe on top it is tricky getting a counter to work. I'll have to play with it some more.
 
asp version:
strMessage1 = Request.Form("MessageText")
 lengthOfString = len(strMessage1) 'determine length of string
 If lengthOfString > 5 then 'if greater than 5 kick back to previous page with data
  response.redirect "message.asp?MF=" & strMessage1
 end if


Posted By: fwsteal
Date Posted: 26 January 2006 at 4:36pm
Here is another attempt:
 
default.asp
<form name="myForm" id="myForm" method="post" action="display_form_submission.asp" onSubmit="textCounter(textarea,10)">
<textarea name="textarea" cols="80" rows="15" id="myTextarea" >
 

RTE_javascript.asp
'***********************************************
'***   JavaScript initialising RTE editor  *****
'***********************************************
%>
//character count
function textCounter(theField, maxlimit){if(theField.value.length == maxlimit) return false;}
 
I don't understand why this wouldn't work; any ideas?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net