Hello Monks

I'm attempting to use HTML::FormHandler to build HTML forms with bootstrap. However, it seems that bootstrap inserts... "arbitrary?" divs that FormHandler isn't capable of dealing with. HTML::FormHandler::Widget::Wrapper::Bootstrap seems to add methods like "before_element" that might allow me to set some of the divs. I find that I'm unable to arbitrarily group html elements like bootstrap does (e.g. grouping all the input fields in a sinlge div )

For instance, here's my form and module.

Form:

<h3>Contact Us</h3> <div class="container col-md-8"> <form class="navbar-form navbar-left" id="form858" method="post"> <div class="form_messages"> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="sender">Name</l +abel> <input type="text" name="sender" id="sender" value="" clas +s="form-control" /> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="email">Email Ad +dress</label> <input type="text" name="email" id="email" value="" class= +"form-control" /> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="subject">Subject +</label> <input type="text" name="subject" id="subject" value="" cla +ss="form-control" /> </div> <div class="form-group"> <label class="col-sm-2 control-label" for="message">Messag +e</label> <textarea name="message" id="message" class="form-control" + rows="3" rows="5" cols="10"></textarea> </div> <div class="form-group"> <input type="submit" name="submit" id="submit" value="Subm +it" class="btn btn-default" /> </div> </form>

Module

package My::Form::Contact; use HTML::FormHandler::Moose; use HTML::FormHandler::Types qw(NonEmptySimpleStr Printable Password); use namespace::autoclean; extends 'HTML::FormHandler'; has_field sender => ( label => 'Name', label_class => [qw(col-sm-2 control-label)], required => 1, apply => [NonEmptySimpleStr, Printable], element_class => [qw(form-control)], wrapper_class => [qw(form-group)], ); has_field email=> ( label => 'Email Address', label_class => [qw(col-sm-2 control-label)], required => 1, apply => [NonEmptySimpleStr, Printable], element_class => [qw(form-control)], wrapper_class => [qw(form-group)], ); has_field subject=> ( label => 'Subject', label_class => [qw(col-sm-2 control-label)], required => 1, apply => [NonEmptySimpleStr, Printable], element_class => [qw(form-control)], wrapper_class => [qw(form-group)], ); has_field message => ( label => 'Message', label_class => [qw(col-sm-2 control-label)], type => 'TextArea', required => 1, apply => [NonEmptySimpleStr, Printable], element_attr => { rows => 3, }, element_class => [qw(form-control)], wrapper_class => [qw(form-group)], ); has_field submit => ( label_class => [qw(col-sm-2 control-label)], type => 'Submit', value => 'Submit', element_class => [qw(btn btn-default)], wrapper_class => [qw(form-group)], ); # The <form > element class sub build_form_element_class {{ [qw(navbar-form navbar-left)] }} __PACKAGE__->meta->make_immutable(); 1;

I would like to replicate the horizontal bootstrap form.

Has anyone used Bootstrap 3 with HTML::FormHandler?

Thanks!


In reply to Has anyone used HTML::FormHandler::Widget::Wrapper::Bootstrap with Bootstrap > 3.0? by three18ti

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.