Reputation: 529
With a HTML::FormHandler formular I want to render only the field part of an form field.
<div>
my label [% form.field('name').render %]
</div>
This renders the field and a label.
Upvotes: 1
Views: 535
Reputation: 69
For future searchers:
You can set the do_label
attribute when you define your field in the form class.
has_field 'name' => (
type => 'Text'
do_label => 0,
);
Source: HTML::FormHandler field attribute reference
Upvotes: 1
Reputation: 529
I've found an another way in the manual of HFH.
package Test::Form;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
has '+name' => ( default => 'testform' );
has '+widget_wrapper' => ( default => 'None' );
has '+auto_fieldset' => ( default => 0 );
has_field 'foo';
Upvotes: 0
Reputation: 546
I see in the code that the renderer checks for:
$self->has_flag('no_render_label')
so you need to set this flag. How it is done? I can only make a guess.
you did not specify which widget you are using, and if I understand it right, you should extend him and create your own widget.
package HTML::FormHandler::Field::Checkbox::NoLabel;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler::Field::Checkbox';
our $VERSION = '0.01';
has '+no_render_label' => ( default => 1 );
Upvotes: 3