Skip Menu |
 

This queue is for tickets about the HTML-DOM CPAN distribution.

Report information
The Basics
Id: 64943
Status: resolved
Priority: 0/
Queue: HTML-DOM

People
Owner: Nobody in particular
Requestors: martin [...] akm.com.au
Cc:
AdminCc:

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



Subject: Problem is Radio Buttons in HTML::DOM
Download (untitled) / with headers
text/plain 302b
Hi, I have found a problem with Radio Buttons using HTML::DOM. The problem you cannot change the value of a NodeList::Radio using the ->value() method. The value remains unchanged. Attached is a patch that fixes the problem, for me at least. Doesn't seem to break anything else. Regards, Martin
Subject: radio_button_fix.patch
--- Form.pm.orig 2011-01-20 11:59:39.494304600 +1000 +++ Form.pm 2011-01-20 12:02:33.111803357 +1000 @@ -430,16 +430,19 @@ $checked_elem = $btn, last; } - if (@_) { for (0..$self->length-1) { - my $btn = $self->item($_); - $_[0] eq $btn->attr('value') and - $btn->disabled && croak( - "The value '$_[0]' has been disabled for field '${\ - $self->name}'" - ), - $btn->checked(1), - last; - }} + if (@_) { + foreach my $element (@$self) { + if ($_[0] eq $element->attr('value')) { + if ($element->disabled) { + croak("The value '$_[0]' has been disabled for field '${$self->name}'"); + } + $element->checked(1); + } + else { + $element->checked(0); + } + } + } $checked_elem && $checked_elem->attr('value') }
Download (untitled) / with headers
text/plain 664b
On Wed Jan 19 22:52:09 2011, makman wrote: Show quoted text
> Hi, > > I have found a problem with Radio Buttons using HTML::DOM. The problem > you cannot change the value of a NodeList::Radio using the ->value() > method. The value remains unchanged. > > Attached is a patch that fixes the problem, for me at least. Doesn't seem > to break anything else. > > Regards, > Martin
Thank you for the report and proposed fix. It turns out that the real problem is with the ‘checked’ method of radio buttons. When called with a true value, it is supposed to uncheck other buttons in the same group, but I forgot to program it to do that! It is now fixed in version 0.046.


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.