Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Has anyone used HTML::FormHandler::Widget::Wrapper::Bootstrap with Bootstrap > 3.0?

by three18ti (Monk)
on Feb 17, 2014 at 11:47 UTC ( [id://1075160]=perlquestion: print w/replies, xml ) Need Help??

three18ti has asked for the wisdom of the Perl Monks concerning the following question:

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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1075160]
Approved by Corion
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-19 15:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found