Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - textarea character counter
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum Lockedtextarea character counter

 Post Reply Post Reply
Author
fwsteal View Drop Down
Newbie
Newbie


Joined: 25 January 2006
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fwsteal Quote  Post ReplyReply Direct Link To This Post Topic: textarea character counter
    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?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
fwsteal View Drop Down
Newbie
Newbie


Joined: 25 January 2006
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fwsteal Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2006 at 3:40pm
You can do, using an onSubmit event that counts the value of the original textarea.
Back to Top
fwsteal View Drop Down
Newbie
Newbie


Joined: 25 January 2006
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fwsteal Quote  Post ReplyReply Direct Link To This Post Posted: 25 January 2006 at 4:50pm
I'm not a javascript guy so how would it be handled?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
fwsteal View Drop Down
Newbie
Newbie


Joined: 25 January 2006
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fwsteal Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
fwsteal View Drop Down
Newbie
Newbie


Joined: 25 January 2006
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote fwsteal Quote  Post ReplyReply Direct Link To This Post 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?


Edited by fwsteal - 26 January 2006 at 4:37pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.