Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7901

Show
Ignore:
Timestamp:
10/15/07 05:03:23 (11 months ago)
Author:
nzkoz
Message:

Enhance documentation for observe_field. Closes #9808 [RubyRedRick, danger]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/prototype_helper.rb

    r7831 r7901  
    316316      #                       when the field has changed. 
    317317      # <tt>:function</tt>::  Instead of making a remote call to a URL, you 
    318       #                       can specify a function to be called instead. 
     318      #                       can specify javascript code to be called instead. 
     319      #                       Note that the value of this option is used as the 
     320      #                       *body* of the javascript function, a function definition 
     321      #                       with parameters named element and value will be generated for you 
     322      #                       for example: 
     323      #                         observe_field("glass", :frequency => 1, :function => "alert('Element changed')") 
     324      #                       will generate: 
     325      #                         new Form.Element.Observer('glass', 1, function(element, value) {alert('Element changed')}) 
     326      #                       The element parameter is the DOM element being observed, and the value is its value at the 
     327      #                       time the observer is triggered. 
    319328      #  
    320329      # Additional options are: