0

I'm using HTML::FormHandler and creating a dynamic form, and I'd like to be able to use HTML::FormHandler::Widget::Theme::Bootstrap with it.

However, I can't figure out how to get a dynamic form to include 'withs'. The documentation shows that you create a dynamic form like so:

my $form = HTML::FormHandler->new(
name => 'user_form',
item => $user,
field_list => [
    'username' => {
        type  => 'Text',
        apply => [ { check => qr/^[0-9a-z]*\z/,
           message => 'Contains invalid characters' } ],
    },
    'select_bar' => {
        type     => 'Select',
        options  => \@select_options,
        multiple => 1,
        size     => 4,
    },
],
);

Does anyone know how I could get this form to use HTML::FormHandler::Widget::Theme::Bootstrap?

madth3
  • 7,275
  • 12
  • 50
  • 74
srchulo
  • 5,143
  • 4
  • 43
  • 72

1 Answers1

0

Since HTML::FormHandler::Widget::Theme::Bootstrap is really just a Moose::Role, you should be able to apply it to an instance of your form like so:

use HTML::FormHandler::Widget::Theme::Bootstrap;
HTML::FormHandler::Widget::Theme::Bootstrap->meta->apply($form);

it is Moose at the end of the day.

ashraf
  • 537
  • 7
  • 16