0

I'm using HTML::FormHandler to dynamically create a form like so:

my $form = HTML::FormHandler->new(
    name => 'types',
    field_list => \@field_list,
    widget_name_space => ['my_app::Form::Widget'],
); 

I am trying to use my own widget for a field by setting it like this:

field => {
    type  => 'Checkbox',
    label  => $_->{label},
    widget_wrapper => 'MyWidget',
};

However, whenever I try to create the form I get this error:

"Can't find Wrapper widget MyWidget from my_app::Form::Widget, 
HTML::FormHandler::Widget, HTML::FormHandlerX::Widget at
/usr/local/share/perl5/HTML/FormHandler/Widget/ApplyRole.pm line 39."

I am able to use this widget with forms that I have defined in files, but for some reason whenever I try to create a form on the fly like this I get this error. Does anyone know what I'm doing wrong? Thanks!

srchulo
  • 5,143
  • 4
  • 43
  • 72
  • 1
    What is the package name of your wrapper? It must be `my_app::Form::Widget::Wrapper::MyWidget`. – Denis Ibaev Mar 08 '13 at 06:40
  • Ah, thank you. The issue was that I was using the path that is used for `widget`s (`my_app::Form::Widget::Field::MyWidget`) and not `widget_wrappers`. Thanks for pointing that out. – srchulo Mar 08 '13 at 08:01

0 Answers0