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

Changeset 6536

Show
Ignore:
Timestamp:
04/17/07 17:41:22 (1 year ago)
Author:
madrobby
Message:

Fix Form.request for forms containing an input element with name="action". Closes #8063.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/trunk/CHANGELOG

    r6534 r6536  
    11*SVN* 
     2 
     3* Fix Form.request for forms containing an input element with name="action".  Closes #8063.  [Thomas Fuchs, Mislav Marohnić] 
     4 
     5* Make Event.element extend the returned element.  Closes #7870.  [Thomas Fuchs] 
    26 
    37* Prevent a crash on Safari on String.prototype.stripScripts and extractScripts with large <script> tags.  [Thomas Fuchs] 
  • spinoffs/prototype/trunk/src/form.js

    r6474 r6536  
    9494      options.method = form.method; 
    9595     
    96     return new Ajax.Request(form.action, options); 
     96    return new Ajax.Request(form.readAttribute('action'), options); 
    9797  } 
    9898} 
  • spinoffs/prototype/trunk/test/unit/form.html

    r6474 r6536  
    2929  <input type="text" name="val2" id="input_disabled" disabled="disabled" value="5" /> 
    3030  <input type="submit" /> 
     31  <input type="text" name="action" value="blah" /> 
    3132</form> 
    3233<div id="form_wrapper"> 
     
    311312      // Checks that disabled element is not included in serialized form. 
    312313      $('input_enabled').enable(); 
    313       assertEqual('val1=4', Form.serialize('form')); 
     314      assertEqual('val1=4&action=blah', Form.serialize('form')); 
    314315 
    315316      // Checks that select-related serializations work just fine 
     
    367368      request = $("form").request(); 
    368369      assert($("form").hasAttribute("method")); 
    369       assert(request.url.endsWith("fixtures/empty.js?val1=4")); 
     370      assert(request.url.endsWith("fixtures/empty.js?val1=4&action=blah")); 
    370371      assertEqual("get", request.method); 
    371372       
    372373      request = $("form").request({method: "post"}); 
    373374      assert(request.url.endsWith("fixtures/empty.js")); 
    374       assertEqual("val1=4", Hash.toQueryString(request.options.parameters)); 
     375      assertEqual("val1=4&action=blah", Hash.toQueryString(request.options.parameters)); 
    375376      assertEqual("post", request.method); 
    376377    }},