[html-formfu] Wrapping input inside <label>...</label> for
	Checkboxgroup
    kewei xiao 
    kewei.xiao at nald.ca
       
    Wed Mar 12 16:10:31 GMT 2008
    
    
  
Hi guys
    I am trying to wrap input box inside <label>...</label> for my 
customized checkboxgroup, like this:
   <label>
       <input....../>
   </label>
   right now my code separate them, like this:
   <input.../>
   <label></label>
   here is what I do:
    use base qw( HTML::FormFu::Element::Checkboxgroup );
sub setup {
    my $self = shift;
    $self->type( 'checkboxgroup'  );
    $self->container_tag( 'div' );
    my $c        = $self->form->stash->{ context };
    my $keywords = $c->model( 'Activities::Keyword' )
        ->search( undef, { order_by => 'name' } );
    $self->name( 'keywords' );
    $self->options(
        [   map {
                {
                    label   => $_->name,
                    value   => $_->keyword_id,
                    attributes => { id => 'keyword_' . $_->keyword_id }
                }
                } $keywords->all
        ]
    );
    return $self->next::method( @_ );
}
Any suggestions?  Thanks in advance
Kewei
    
    
More information about the HTML-FormFu
mailing list