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

Ticket #9808: observe_field_doc.2.diff

File observe_field_doc.2.diff, 1.5 kB (added by danger, 2 years ago)

updated patch and fixed syntax

  • actionpack/lib/action_view/helpers/prototype_helper.rb

    old new  
    315315      # <tt>:url</tt>::       +url_for+-style options for the action to call 
    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: 
    321330      # <tt>:frequency</tt>:: The frequency (in seconds) at which changes to