[Dbix-class] DBIx::Class::HTMLWidget (checkboxes)

Ash Berlin ash at cpan.org
Fri Jul 14 12:39:23 CEST 2006


Dennis Schön wrote:
> Ash Berlin wrote:
>   
>> Dennis Schön wrote:
>>     
>>> I narrowed the problem down to the following code in HTMLWidget.pm line 43:
>>>
>>> my %cb = map {$_->name => undef if 
>>> $_->isa('HTML::Widget::Element::Checkbox')} @{ $result->{_elements} };
>>>
>>> [the %cb hash ought to contain the checkbox names as keys]
>>>
>>> I replaced that line with the not so fancy, but for me working:
>>> my %cb;
>>> foreach (@{ $result->{_elements} }) {
>>>      if ( $_->isa('HTML::Widget::Element::Checkbox') ) {
>>>          $cb{$_->name} = undef;
>>>      }
>>> }
>>>
>>>       
>
>   
>> Could you test the latest SVN version? 
>> http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class-HTMLWidget/
>>
>> I know there have been a lot of changes to the CB code. Let us know how 
>> the SVN version copes with you checkboxes.
>>     
>
> Still no success. :-( I tried to debug a bit but unfortunatly i don't 
> really understand whats going on. Especially the "$result->{_embedded}".
>
>       36     #   find all checkboxes
>       37     my @elements;
>       38 ····
>       39     if ($result->{_embedded}) {
>       40         my @widgets = @{ $result->{_embedded} || [] };
>       41         foreach (@widgets) {
>       42             push @elements, $_->get_elements();
>       43         }
>       44     } else {
>       45         @elements = $result->elements;
>       46     }
>       47
>       48     my %cb = map {$_->name => undef } grep { 
> $_->isa('HTML::Widget::Element::Checkbox')}·
>       49     @elements;
>
> that is the relevant code in the latest svn version. In my case line 39 
> returns true but "@widgets" is empty -> which results in an empty "%cb".
>
> Again, if i replace all this code with my snippet from above everything 
> is working.
>
> Dennis
>
>   
Could you send me the snippet that produces your Widget?

(Part of the problem here is that no-one ever got round to producing any 
tests for this module. Sloppy, and I've not got round to doing so either 
yet)

Thanks
Ash





More information about the Dbix-class mailing list