Skip Menu |

This queue is for tickets about the libwww-perl CPAN distribution.

Report information
The Basics
Id: 33512
Status: resolved
Priority: 0/
Queue: libwww-perl

Owner: Nobody in particular
Requestors: asjo [...]

Bug Information
Severity: Normal
Broken in: 5.808
Fixed in: (no value)

Subject: Disabled, checked radiobutton being submitted [patch]
When I have a disabled, checked radiobutton and a hidden field, both with the same name, the disabled radiobutton "succeeds" and it's value is submitted by HTML::Form. If I understand section 17.12.1 "Disabled controls"¹ in the HTML 4.01 standard correctly, the radiobutton should not succeed when disabled, and this following test should be valid (patch against libwww-perl-5.808, Debian testing): --- t/html/form.t.orig 2008-02-12 10:33:18.000000000 +0100 +++ t/html/form.t 2008-02-12 10:34:20.000000000 +0100 @@ -3,7 +3,7 @@ use strict; use Test qw(plan ok); -plan tests => 122; +plan tests => 123; use HTML::Form; @@ -417,6 +417,20 @@ ok(eval{$f->find_input("m3", undef, 2)->value(undef)}, undef); ok($@ && $@ =~ /^The 'm3' field can't be unchecked/); +# Try a disabled radiobutton: +$f = HTML::Form->parse(<<EOT, "http://localhost/"); +<form> + <input disabled checked type=radio name=f value=a> + <input type=hidden name=f value=b> +</form> + +EOT + +ok($f->click->as_string, <<'EOT'); +GET http://localhost/?f=b + +EOT + $f = HTML::Form->parse(<<EOT, ""); <!-- from --> <form METHOD="post" ACTION="" ENCTYPE="application/x-www-form-urlencoded"> (Neither Mozilla nor Microsoft Internet Explorer submits the radiobutton value, not that that proves anything...) Here is a patch that fixes the problem for me: --- lib/HTML/ 2008-02-12 11:27:05.000000000 +0100 +++ lib/HTML/ 2008-02-12 11:22:57.000000000 +0100 @@ -903,7 +903,7 @@ my $self = shift; my $name = $self->{'name'}; return unless defined $name; - return if $self->{disabled}; + return if $self->disabled; my $value = $self->value; return unless defined $value; return ($name => $value); P.S. I wasn't sure if writing this on the mailinglist was sufficient, so I have created this bug-report as well. ¹ <>
Applied. Thanks!

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to