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