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

Changeset 6134

Show
Ignore:
Timestamp:
02/06/07 17:48:38 (3 years ago)
Author:
david
Message:

Fix that FormTagHelper#submit_tag using :disable_with should trigger the onsubmit handler of its form if available [DHH]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r6130 r6134  
    11*SVN* 
    22 
    3 # Fix #render_file so that TemplateError is called with the correct params and you don't get the WSOD.  [Rick] 
     3* Fix that FormTagHelper#submit_tag using :disable_with should trigger the onsubmit handler of its form if available [DHH] 
     4 
     5* Fix #render_file so that TemplateError is called with the correct params and you don't get the WSOD.  [Rick] 
    46 
    57* Fix issue with deprecation messing up #template_root= usage.  Add #prepend_view_path and #append_view_path to allow modification of a copy of the 
  • trunk/actionpack/lib/action_view/helpers/form_tag_helper.rb

    r6057 r6134  
    142142         
    143143        if disable_with = options.delete("disable_with") 
    144           options["onclick"] = "this.disabled=true;this.value='#{disable_with}';this.form.submit();#{options["onclick"]}" 
     144          options["onclick"] = [ 
     145            "this.disabled=true", 
     146            "this.value='#{disable_with}'", 
     147            "#{options["onclick"]}", 
     148            "return (this.form.onsubmit ? this.form.onsubmit() : true)", 
     149          ].join(";") 
    145150        end 
    146151           
  • trunk/actionpack/test/template/form_tag_helper_test.rb

    r6057 r6134  
    133133  def test_submit_tag 
    134134    assert_dom_equal( 
    135       %(<input name='commit' type='submit' value='Save' onclick="this.disabled=true;this.value='Saving...';this.form.submit();alert('hello!')" />), 
     135      %(<input name='commit' type='submit' value='Save' onclick="this.disabled=true;this.value='Saving...';alert('hello!');return (this.form.onsubmit ? this.form.onsubmit() : true)" />), 
    136136      submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')") 
    137137    )