I''m desperately trying to update a div when a key is pressed in a text field. Eg. : <input type="text" id="field"> <div id="area"></div> <%= observe_field :field, :url => {:action => :myAction}, :update => :area, :with => "text_param", :on => ''keypress'' %> This does not seem to work, and I can''t understand why. Does someone have any clue on what I am doing wrong ? Thanks in advance -- Posted via http://www.ruby-forum.com/.
CambrianJoe
2006-Aug-13 01:11 UTC
[Rails] Re: Catching "keypress" event with observe_field
I don''t use AJAX, but I''ll see if I can help. Just some thoughts: 1. Right click on the loaded page and view source to make sure javascript is in the headers. Maybe observe_field isn''t being loaded. 2. Instead of using keypress, does it work with frequency? I know that is not what you want, but it might give you some ideas. 3. Try text_field_tag as well for the input. -- Posted via http://www.ruby-forum.com/.
Thanks for you reply !> 1. Right click on the loaded page and view source to make sure > javascript is in the headers. Maybe observe_field isn''t being loaded.Yep, it''s loaded.> 2. Instead of using keypress, does it work with frequency? I know that > is not what you want, but it might give you some ideas.Already done that, and yes, it works very well.> 3. Try text_field_tag as well for the input.Just tried, but it doesn''t work either. I really don''t know what to try next... Thanks anyway -- Posted via http://www.ruby-forum.com/.