Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 44430
Status: resolved
Priority: 0/
Queue: WWW-Mechanize

People
Owner: Nobody in particular
Requestors: way [...] ipsite.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: missing value for field input with image as type
Hello, Exists a bug, at list if this module follow the HTML4 specification and normal browsers, the problem is because don't send the specific value attribute of an input field that has image as type, when of course exists a name attribute. Here's a discussion http://www.perlmonks.org/?node_id=751884 Cheers, Michael
I created the attached patch but then decided that this behaviour is actually wrong so I did not really apply it to the master branch. Do you have any more information about what browsers implement <input type=image> this way?
From 38062782e92a3c9f371357cfca6a24fa8192da66 Mon Sep 17 00:00:00 2001 From: Gisle Aas <gisle@aas.no> Date: Mon, 15 Jun 2009 18:34:26 +0200 Subject: [PATCH] Submit the name/value pair even for image inputs [RT#44430] Reading the specs it clearly looks like the behaviour enabled by this change is wrong. According to <http://www.perlmonks.org/?node_id=751884> it looks like Firefox submits the value while IE doesn't. --- lib/HTML/Form.pm | 8 +++++--- t/html/form.t | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/HTML/Form.pm b/lib/HTML/Form.pm index 0885ce3..ced9307 100644 --- a/lib/HTML/Form.pm +++ b/lib/HTML/Form.pm @@ -1329,9 +1329,11 @@ sub form_name_value return if $self->{disabled}; my $name = $self->{name}; $name = (defined($name) && length($name)) ? "$name." : ""; - return ("${name}x" => $clicked->[0], - "${name}y" => $clicked->[1] - ); + return ( + "${name}x" => $clicked->[0], + "${name}y" => $clicked->[1], + $self->SUPER::form_name_value(@_), + ); } #--------------------------------------------------- diff --git a/t/html/form.t b/t/html/form.t index 2cd72e3..bc722cb 100644 --- a/t/html/form.t +++ b/t/html/form.t @@ -3,7 +3,7 @@ use strict; use Test qw(plan ok); -plan tests => 126; +plan tests => 127; use HTML::Form; @@ -105,6 +105,19 @@ GET http://localhost/?x=1&y=1&t=1 EOT +$f = HTML::Form->parse(<<'EOT', "http://localhost/"); +<form> + <input type=image name="i" value="x"> + <input type=text name=t value="1"> +</form> +EOT + +#$f->dump; +ok($f->click->as_string, <<'EOT'); +GET http://localhost/?i.x=1&i.y=1&i=x&t=1 + +EOT + # test file upload $f = HTML::Form->parse(<<'EOT', "http://localhost/"); <form method=post enctype="MULTIPART/FORM-DATA"> -- 1.6.2.95.g934f7
migrated queue: libwww-perl -> WWW-Mechanize