[html-formfu] Subclassing HTML::FormFu::Element::Select

Zbigniew Lukasiak zzbbyy at gmail.com
Sat Sep 22 16:19:22 GMT 2007


Hi Carl,

I've tried to subclass HTML::FormFu::Element::Select to experiment a
bit with DBIC and FormFu integration, but I failed.  Here is what I
done:

The script:

use HTML::FormFu;

my $form = HTML::FormFu->new;
$form->load_config_file('t/var/config.yml');
warn $form->render;

The config:

---
elements:
   - type: "Select::DBIC"
     name: foo
     options:
       - [ 01, January ]
       - [ 02, February ]
       - value: 03
         label: March
         attributes:
           style: highlighted
       - [ 04, April ]

When I change Select::DBIC to Select this config works.

Then I have an empty Select::DBIC class:

package HTML::FormFu::Element::Select::DBIC;
use strict;

BEGIN {
    use vars qw($VERSION );
    $VERSION     = '0.01';
}

use base 'HTML::FormFu::Element::Select';

After some debugging I've added two more methods:

sub render_class {
    return 'HTML::FormFu::Render::Element::field';
}

sub render_class_args {
    return {};
}

But it still fails with:
Can't locate object method "submitted" via package
"HTML::FormFu::Element::Select::DBIC" at
/home/zby/svn/html-formfu/HTML-FormFu/lib//HTML/FormFu/Element/_Group.pm
line 125.

What do I wrong?

-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the HTML-FormFu mailing list