FAQ

[Html-widget] DBIx::Class::HTMLWidget - Fix for HTML::Widget::Element::Radio

Michael Gray
Jul 25, 2006 at 2:47 pm
The attached patch fixes up DBIx::Class::HTMLWidget version 0.06 for a
widget containing a set (or sets) of HTML::Widget::Element::Radio
buttons.

I've not attempted to do anyting with RadioGroup yet, because I'm not
using them.

--
Michael
-------------- next part --------------
*** lib/DBIx/Class/HTMLWidget.pm~ 2006-06-15 16:04:35.000000000 +0100
--- lib/DBIx/Class/HTMLWidget.pm 2006-07-25 14:43:06.293587390 +0100
***************
*** 24,34 ****
my $name=$element->name;
next unless $name && $dbic->can($name) && $element->can('value');
if($element->isa('HTML::Widget::Element::Checkbox')) {
! $element->checked($dbic->$name?1:0);
! } else {
! $element->value($dbic->$name)
! unless $element->isa('HTML::Widget::Element::Password');
! }
}
}

--- 24,37 ----
my $name=$element->name;
next unless $name && $dbic->can($name) && $element->can('value');
if($element->isa('HTML::Widget::Element::Checkbox')) {
! $element->checked($dbic->$name?1:0);
! } elsif($element->isa('HTML::Widget::Element::Radio')) {
! next unless defined $dbic->$name;
! $element->checked($dbic->$name eq $element->value() ? 1 : 0);
! } else {
! $element->value($dbic->$name)
! unless $element->isa('HTML::Widget::Element::Password');
! }
}
}
reply

Search Discussions

1 response

Related Discussions

Discussion Navigation
viewthread | post

1 user in discussion

Michael Gray: 2 posts