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 -- Posted via http://www.ruby-forum.com/.
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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org> bb-- Posted via http://www.ruby-forum.com/.
> 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. -- Posted via http://www.ruby-forum.com/.