[Rt-commit] rt branch, 4.2/ie-submit-button, created. rt-4.2.0-1-ge827789

Alex Vandiver alexmv at bestpractical.com
Fri Oct 11 15:18:29 EDT 2013


The branch, 4.2/ie-submit-button has been created
        at  e8277894b339bf12dce1ca1f8b6d5a8fb5eb20de (commit)

- Log -----------------------------------------------------------------
commit e8277894b339bf12dce1ca1f8b6d5a8fb5eb20de
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Oct 11 15:14:46 2013 -0400

    Insert hidden name=value input after button, not inside of it
    
    jQuery's .append() method inserts the given node within each element,
    after all other elements contained within it.  This means that
    $this.append( jQuery('<input/>', ... )) effectively attempts to produce:
    
      <input type="submit">
        <input type="hidden" />
      </input>
    
    Most browsers correctly interpreted this somewhat bogus jQuery
    modification, and included the new hidden form element in the
    submission; IE9 and IE10 do not.  As such, many pages failed to update
    when the submit button was pressed, as the button's value was not seen
    on the new page load.
    
    Use .after(), which correctly appends the value after the existing
    element, not within it.

diff --git a/share/static/js/forms.js b/share/static/js/forms.js
index 1b6fa9a..57132be 100644
--- a/share/static/js/forms.js
+++ b/share/static/js/forms.js
@@ -7,7 +7,7 @@ jQuery(function() {
     var $this = jQuery(this);
     var name = $this.attr('name');
     if (!name) { return true; }
-    $this.append( jQuery('<input/>', {type: "hidden", name: name, value: $this.val()} ) );
+    $this.after( jQuery('<input/>', {type: "hidden", name: name, value: $this.val()} ) );
     return true;
   })
 });
\ No newline at end of file

-----------------------------------------------------------------------


More information about the Rt-commit mailing list