• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Textarea with character countdown
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Textarea with character countdown


  • Subject: Re: Textarea with character countdown
  • From: Simon <email@hidden>
  • Date: Mon, 11 Oct 2010 13:48:24 +0100

no component, but here is how we do it:

<label for = "message">Message</label>
              <wo:text value = "$comments" id = "message" onKeyUp =
"return count(this,255,'myCounter')" />
              <p class = "desc">You have
                <span id = "myCounter"><wo:str value =
"~255-comments.length" /></span>
                characters left.</p>


function count(a,b,c){
	var dif = b-a.value.length;
	while (dif < 0) {
		a.value=a.value.replace(/.$/,'')
		dif = b-a.value.length;
	}
	document.getElementById(c).firstChild.data=dif;
}


Simon




On 11 October 2010 12:50, Paul Hoadley <email@hidden> wrote:
> Hello,
>
> I have a use case for a textarea with a Twitter-style character countdown from some specifiable limit.  Specifically:
>
> 1.  Text area with a character limit count somewhere nearby.
> 2.  Count decreases by one for each character typed.
> 3.  Count decreases by the total length of anything pasted in.
> 4.  Excess content is not prevented, but the count goes negative.
>
> Basically, I'm describing exactly (New)Twitter's widget.  (I want to use it for SMS message content.)
>
> So, here's me as an optimist: does anyone have or know of a WOComponent that does exactly this that I can just drop right in?  :-)  Failing that, I'm not up to speed on Twitter's API or, in particular, exactly what parts of their UI are re-usable—does anyone know if this widget is freely usable in any form?  Failing that, can anyone recommend a good Javascript implementation of something like this, preferably _not_ using JQuery (as I want to just drop it into pages already using Ajax.framework)?
>
> Failing all of those, I'll write one myself.
>
>
> --
> Paul.
>
> http://logicsquad.net/
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Textarea with character countdown
      • From: Paul Hoadley <email@hidden>
References: 
 >Textarea with character countdown (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Textarea with character countdown
  • Next by Date: Re: Textarea with character countdown
  • Previous by thread: Textarea with character countdown
  • Next by thread: Re: Textarea with character countdown
  • Index(es):
    • Date
    • Thread