From 61639262f10be98f4839649b84689d27c18b5c8c Mon Sep 17 00:00:00 2001 From: Michael Koziarski Date: Mon, 15 Oct 2007 05:03:23 +0000 Subject: 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 --- actionpack/lib/action_view/helpers/prototype_helper.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 # :url:: +url_for+-style options for the action to call # when the field has changed. # :function:: 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: # :frequency:: The frequency (in seconds) at which changes to -- cgit v1.2.3