On Thu, Aug 6, 2009 at 00:43, <lib...@perlmeister.com> wrote:
> If you have a HTML form like
>
>    <form>
>       <input type=submit value="Upload it!" name=n>
>       <input type=text name=t value="1">
>    </form>
>
> then after clicking on the 'submit' button, the browser will send
> a query string like
>
>    ?n=Upload+it!&t=1
>
> to the server. HTML::Form, however, skips the name/value of the submit
> button and just sends
>
>    ?t=1.
>
> Is this intentional or an oversight?

As far as I can remember it was intentional.  The browsers at the time
used to only send ?t=1 when you submitted the form by pressing return
in the text field and both when you clicked on the button.  HTML::Form
supported both these by calling either ->make_request or ->click
method.  If all modern browsers agree that the button value should
always be passed we should change as well.


> P.S.:
>
> So I turned to the libwww test suite and looked at t/html/form.t:
>
>    $f = HTML::Form->parse(<<'EOT', "http://localhost/";);
>    <form>
>       <input type=submit value="Upload it!" name=n disabled>
>       <input type=image alt="Foo">
>       <input type=text name=t value="1">
>    </form>
>    EOT
>
>    #$f->dump;
>    ok($f->click->as_string, <<'EOT');
>    GET http://localhost/?x=1&y=1&t=1
>
>    EOT
>
> Is "x=1&y=1" a standard if there's an input image? My browser (FF3) doesn't
> seem to think so.

The standard (HTML 4.01) does not say what to do when the image has no
name.  I think this was picked up from inspecting the behaviour of
some browser but not sure which one.

--Gisle

Reply via email to