<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,7 @@
 *Edge*
 
+* Added button_to_remote helper.  #3641 [Donald Piret, Tarmo T&#228;nav]
+
 * Deprecate render_component. Please use render_component plugin from http://github.com/rails/render_component/tree/master [Pratik]
 
 * Routes may be restricted to lists of HTTP methods instead of a single method or :any.  #407 [Brennan Dunn, Gaius Centus Novus]</diff>
      <filename>actionpack/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -255,6 +255,14 @@ module ActionView
         link_to_function(name, remote_function(options), html_options || options.delete(:html))
       end
 
+      # Creates a button with an onclick event which calls a remote action
+      # via XMLHttpRequest
+      # The options for specifying the target with :url
+      # and defining callbacks is the same as link_to_remote.
+      def button_to_remote(name, options = {}, html_options = {})
+        button_to_function(name, remote_function(options), html_options)
+      end
+
       # Periodically calls the specified url (&lt;tt&gt;options[:url]&lt;/tt&gt;) every
       # &lt;tt&gt;options[:frequency]&lt;/tt&gt; seconds (default is 10). Usually used to
       # update a specified div (&lt;tt&gt;options[:update]&lt;/tt&gt;) with the results</diff>
      <filename>actionpack/lib/action_view/helpers/prototype_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -91,6 +91,19 @@ class PrototypeHelperTest &lt; PrototypeHelperBaseTest
       link_to_remote(&quot;Remote&quot;, { :url =&gt; { :action =&gt; &quot;whatnot's&quot; } })
   end
 
+  def test_button_to_remote
+    assert_dom_equal %(&lt;input class=\&quot;fine\&quot; type=\&quot;button\&quot; value=\&quot;Remote outpost\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true});\&quot; /&gt;),
+      button_to_remote(&quot;Remote outpost&quot;, { :url =&gt; { :action =&gt; &quot;whatnot&quot;  }}, { :class =&gt; &quot;fine&quot;  })
+    assert_dom_equal %(&lt;input type=\&quot;button\&quot; value=\&quot;Remote outpost\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onComplete:function(request){alert(request.reponseText)}});\&quot; /&gt;),
+      button_to_remote(&quot;Remote outpost&quot;, :complete =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;  })
+    assert_dom_equal %(&lt;input type=\&quot;button\&quot; value=\&quot;Remote outpost\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onSuccess:function(request){alert(request.reponseText)}});\&quot; /&gt;),
+      button_to_remote(&quot;Remote outpost&quot;, :success =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;  })
+    assert_dom_equal %(&lt;input type=\&quot;button\&quot; value=\&quot;Remote outpost\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\&quot; /&gt;),
+      button_to_remote(&quot;Remote outpost&quot;, :failure =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;  })
+    assert_dom_equal %(&lt;input type=\&quot;button\&quot; value=\&quot;Remote outpost\&quot; onclick=\&quot;new Ajax.Request('http://www.example.com/whatnot?a=10&amp;amp;b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}});\&quot; /&gt;),
+      button_to_remote(&quot;Remote outpost&quot;, :failure =&gt; &quot;alert(request.reponseText)&quot;, :url =&gt; { :action =&gt; &quot;whatnot&quot;, :a =&gt; '10', :b =&gt; '20' })
+  end
+
   def test_periodically_call_remote
     assert_dom_equal %(&lt;script type=&quot;text/javascript&quot;&gt;\n//&lt;![CDATA[\nnew PeriodicalExecuter(function() {new Ajax.Updater('schremser_bier', 'http://www.example.com/mehr_bier', {asynchronous:true, evalScripts:true})}, 10)\n//]]&gt;\n&lt;/script&gt;),
       periodically_call_remote(:update =&gt; &quot;schremser_bier&quot;, :url =&gt; { :action =&gt; &quot;mehr_bier&quot; })</diff>
      <filename>actionpack/test/template/prototype_helper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5a6e20b60702fbe86fa84c1b7b5a25f33cec5945</id>
    </parent>
  </parents>
  <author>
    <name>Tarmo T&#228;nav</name>
    <email>tarmo@itech.ee</email>
  </author>
  <url>http://github.com/rails/rails/commit/6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83</url>
  <id>6450d6ca76603bc5d1b1a6cdcb77e33e35f53d83</id>
  <committed-date>2008-08-29T16:22:01-07:00</committed-date>
  <authored-date>2008-08-29T16:08:16-07:00</authored-date>
  <message>Added button_to_remote helper

Ticket originally from http://dev.rubyonrails.org/ticket/3641

Signed-off-by: Jeremy Kemper &lt;jeremy@bitsweat.net&gt;</message>
  <tree>cfe8467e3a16c5a90a4e6aa09a2e99319966bcff</tree>
  <committer>
    <name>Jeremy Kemper</name>
    <email>jeremy@bitsweat.net</email>
  </committer>
</commit>
