aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-10-15 05:03:23 +0000
committerMichael Koziarski <michael@koziarski.com>2007-10-15 05:03:23 +0000
commit61639262f10be98f4839649b84689d27c18b5c8c (patch)
treedd0037ad66e8dd6c6c427083e118b2dc7bdf250a /actionpack/lib
parent2e2ce1f6c99e3423e817003927997f28ba20365b (diff)
downloadrails-61639262f10be98f4839649b84689d27c18b5c8c.tar.gz
rails-61639262f10be98f4839649b84689d27c18b5c8c.tar.bz2
rails-61639262f10be98f4839649b84689d27c18b5c8c.zip
Enhance documentation for observe_field. Closes #9808 [RubyRedRick, danger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7901 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index e19b9097ea..eee2c6a2f4 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -315,7 +315,16 @@ module ActionView
# <tt>:url</tt>:: +url_for+-style options for the action to call
# when the field has changed.
# <tt>:function</tt>:: Instead of making a remote call to a URL, you
- # can specify a function to be called instead.
+ # can specify javascript code to be called instead.
+ # Note that the value of this option is used as the
+ # *body* of the javascript function, a function definition
+ # with parameters named element and value will be generated for you
+ # for example:
+ # observe_field("glass", :frequency => 1, :function => "alert('Element changed')")
+ # will generate:
+ # new Form.Element.Observer('glass', 1, function(element, value) {alert('Element changed')})
+ # The element parameter is the DOM element being observed, and the value is its value at the
+ # time the observer is triggered.
#
# Additional options are:
# <tt>:frequency</tt>:: The frequency (in seconds) at which changes to