Bug#566981: WebKit <form> POSTing ignores the properly named submit input attribute
Josip Rodin
joy at debbugs.entuzijast.net
Tue Jan 26 10:19:49 UTC 2010
Package: libwebkit-1.0-2
Version: 1.1.15.2-1
Tags: upstream
Hi,
A user reported a problem with Chrome, which I reproduced with Midori,
so I'm filing this on the WebKit library that my Midori package uses.
When a HTML form does this:
<form method="post" name="statsFRM">
<script type="text/javascript">
<!--
function submitnormal(action) {
document.statsFRM.action = "?id=something";
document.statsFRM.submit();
}
-->
</script>
<input type="submit" value="Good stuff" name="ok" onclick="submitnormal()">
<input type="submit" value="Bad stuff" name="rej" onclick="submitnormal()">
...the WebKit-based web browsers fail to POST an element named "ok" or "rej"
to the web server.
I could find no obvious explanation for this omission.
http://www.w3.org/TR/html401/interact/forms.html says fairly clearly:
17.13.3 Processing form data
When the user submits a form (e.g., by activating a submit button),
the user agent processes it as follows.
Step one: Identify the successful controls
[...]
17.13.2 Successful controls
A successful control is "valid" for submission. Every successful
control has its control name paired with its current value as part
of the submitted form data set. A successful control must be defined
within a FORM element and must have a control name.
[...]
If a form contains more than one submit button, only the activated
submit button is successful.
[...]
Hence, the activated submit button *is* supposed to be successful as well
as submitted via POST.
There seems to be no reason for the 'onclick' attribute to void the success
of the activated submit button, at least not per 18.2.3 'Intrinsic events'
which defines it.
Please fix this. TIA.
FWIW the workaround I had to use consists of passing the omitted name
as submitnormal('ok') or submitnormal('rej') in the onclick attribute,
and then constructing a new hidden input element just before submission:
wanted_action.setAttribute('type', 'hidden');
wanted_action.setAttribute('name', action);
wanted_action.setAttribute('value', action);
document.statsFRM.appendChild(wanted_action);
--
2. That which causes joy or happiness.
More information about the Pkg-webkit-maintainers
mailing list