Character Counter (javascript required?)

Can anyone help me out with a javascript walk through. I assume this is
something that lots of other’s have done. I have an Advert form and on
it I have a text_field “Advert.description”, it’s validated on
characters, 10…1000, nothing to see here, all perfectly normal, all
working fine.

Now then, I’d like one of those twitter like character count downs above
the field so the user can see how much they’re got left to type or if
they’ve gone over the limit, BEFORE they submit. You get the picture.
How to do? I’d really appreciate a worked example.

Cheers

bb

bingo bob wrote:

Can anyone help me out with a javascript walk through. I assume this is
something that lots of other’s have done. I have an Advert form and on
it I have a text_field “Advert.description”, it’s validated on
characters, 10…1000, nothing to see here, all perfectly normal, all
working fine.

Now then, I’d like one of those twitter like character count downs above
the field so the user can see how much they’re got left to type or if
they’ve gone over the limit, BEFORE they submit. You get the picture.
How to do?

This is not a Rails question. You’ll have better luck on a JavaScript
list.

I’d really appreciate a worked example.

Translation: “I’d really appreciate it if someone would do my work for
me.” I’m sure others will help with problems, but you know, you have to
actually make some effort here. Try writing it yourself, then ask a JS
forum about what doesn’t work.

Cheers

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

bb

bingo bob wrote:

Can anyone help me out with a javascript walk through. I assume this is
something that lots of other’s have done. I have an Advert form and on
it I have a text_field “Advert.description”, it’s validated on
characters, 10…1000, nothing to see here, all perfectly normal, all
working fine.

Now then, I’d like one of those twitter like character count downs above
the field so the user can see how much they’re got left to type or if
they’ve gone over the limit, BEFORE they submit. You get the picture.
How to do?

How about using observe_field, and triggering some kind of action every
.2 second that counts how many characters there are, then updates some
kind of div?

Note that I don’t know exactly how this works, so you may be going back
to your server every .2 seconds to get an update. If you’re lucky, the
action will be embedded in your page and it’ll be done on the
client-side… But Marnen is right, this is, at the core, a Javascript
question.

On Sep 11, 8:02 am, bingo bob [email protected]
wrote:

How to do? I’d really appreciate a worked example.

http://tinyurl.com/ppxf8e

–Matt J.