I am learning Rails 3 and need some help on Ajax part.

I am trying to accomplish the following:
There is a textarea on the page which has a length of letters
constraint, say 100. Every time a symbol is typed there,a nearby label
tells you how many letters you have left.

I plan to use Ajax to do this.

I googled for a few hours and could not figure out how to do this.

So far what I have done is the follows:

Step 1. Add :remote => true to the form_for method. This form_for method
lives in a partial which is called in app/views/foos/home.html.erb

Step 2. Add
respond_to do |format|
format.html
format.js
end

to FoosController's corresponding Home action.

Step 3.create home.js.erb under app/views/foos/

But I do not know how to add something so when a letter is typed in a
textarea inside the form generated by form_for method that home.js.erb
will process.

Could someone help me out here?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to