Fix Form.request for forms containing an input element with name="action". Closes #8063.
This commit is contained in:
parent
bbd0e6eb54
commit
95ac141bd9
|
@ -1,5 +1,9 @@
|
|||
*SVN*
|
||||
|
||||
* Fix Form.request for forms containing an input element with name="action". Closes #8063. [Thomas Fuchs, Mislav Marohnić]
|
||||
|
||||
* Make Event.element extend the returned element. Closes #7870. [Thomas Fuchs]
|
||||
|
||||
* Prevent a crash on Safari on String.prototype.stripScripts and extractScripts with large <script> tags. [Thomas Fuchs]
|
||||
|
||||
* Prevent linefeed normalisation in String.prototype.escapeHTML and unescapeHTML on IE for consistency with other browsers. Speed optimizations for Safari and IE. [Thomas Fuchs]
|
||||
|
|
|
@ -93,7 +93,7 @@ Form.Methods = {
|
|||
if (form.hasAttribute('method') && !options.method)
|
||||
options.method = form.method;
|
||||
|
||||
return new Ajax.Request(form.action, options);
|
||||
return new Ajax.Request(form.readAttribute('action'), options);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
<div>This is not a form element</div>
|
||||
<input type="text" name="val2" id="input_disabled" disabled="disabled" value="5" />
|
||||
<input type="submit" />
|
||||
<input type="text" name="action" value="blah" />
|
||||
</form>
|
||||
<div id="form_wrapper">
|
||||
<form id="form_selects" action="fixtures/empty.js">
|
||||
|
@ -310,7 +311,7 @@
|
|||
|
||||
// Checks that disabled element is not included in serialized form.
|
||||
$('input_enabled').enable();
|
||||
assertEqual('val1=4', Form.serialize('form'));
|
||||
assertEqual('val1=4&action=blah', Form.serialize('form'));
|
||||
|
||||
// Checks that select-related serializations work just fine
|
||||
assertEqual('vu=1&vm%5B%5D=1&vm%5B%5D=3&nvu=One&nvm%5B%5D=One'+
|
||||
|
@ -366,12 +367,12 @@
|
|||
|
||||
request = $("form").request();
|
||||
assert($("form").hasAttribute("method"));
|
||||
assert(request.url.endsWith("fixtures/empty.js?val1=4"));
|
||||
assert(request.url.endsWith("fixtures/empty.js?val1=4&action=blah"));
|
||||
assertEqual("get", request.method);
|
||||
|
||||
request = $("form").request({method: "post"});
|
||||
assert(request.url.endsWith("fixtures/empty.js"));
|
||||
assertEqual("val1=4", Hash.toQueryString(request.options.parameters));
|
||||
assertEqual("val1=4&action=blah", Hash.toQueryString(request.options.parameters));
|
||||
assertEqual("post", request.method);
|
||||
}},
|
||||
|
||||
|
|
Loading…
Reference in New Issue