# How to get observe\_field to work with :on =\> keyup?

**URL:** <https://www.ruby-forum.com/t/how-to-get-observe-field-to-work-with-on-keyup/185957>\
**Category:** Rails\
**Created:** [March 29, 2010, 6:01pm UTC](https://www.ruby-forum.com/t/how-to-get-observe-field-to-work-with-on-keyup/185957 "2010-03-29T18:01:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpaxton](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8c91f0/32.png) [@mpaxton](https://www.ruby-forum.com/u/mpaxton)\
**Post date:** [March 29, 2010, 6:01pm UTC](https://www.ruby-forum.com/t/how-to-get-observe-field-to-work-with-on-keyup/185957/1 "2010-03-29T18:01:56Z")

</div>

Hi All,

I’ve be looking all over for a definitive answer to this question but  
it’s eluding me.

There are many, _many_ examples of the use of observe\_field that include  
:on =\> ‘keyup’ – supposedly allowing one to bind an onkeyup event to a  
form element, etc. I have tried every-which-way to get this to work and  
it does not. When I bore into the code of prototype.js, I can see why:  
the binding has the ‘change’ event hard-coded into it –

Event.observe(element, ‘change’, this.onElementEvent.bind(this));

. . . and when I edit it to ‘keyup’, it does, in fact, catch the onkeyup  
event.

This being the case, how in the world do people get this to work with  
something _other_ than a change event – barring a re-write of the  
prototype code?

For reference, I’m using RadRails on Mac OS X 10.6 with rails 2.3.4 and  
prototype.js 1.6.0.3

Thanks in advance,

Mark
