views:

86

answers:

1

Is there any good reason why most rails developers use observe_field when they want trigger specific action when text input box is changed, rather then using onkeydown? I would expect, that in most of the cases using observe_field results much more code generated than just using native hook onkeydown.

A: 

I think it's just a convenient way rails supplied for the person who doesn't know about javascript, or who doesn't want to write another piece of JavaScript code.

allenwei
it is possible to use onkeydown withut writing any javascript - something like: :onkeydown => update_page { |page| page[:item].toggle }
gorn