[html-formfu] Catalyst::Controller::HTML::FormFu embedding label field in span tag

Carl Franks fireartist at gmail.com
Tue Oct 18 09:20:11 GMT 2011


On 18 October 2011 09:37, abhishek jain <abhishek.netjain at gmail.com> wrote:
>
> Hi,
> Is there  a way i can add each individual form fields within an <li> tag.
> i am talking about some configuration in the yaml config file for
> Catalyst::Controller::HTML::FormFu

Hi,

If you just want to change the DIV tag around each field to a LI tag,
you just need to do this:
    my $tag = { container_tag => 'li' };
    $form->default_args({
        Button => $tag,
        Checkbox => $tag,
        Radio => $tag,
        Text => $tag,
    });
for each different type of element you want to change.
Unfortunately, I don't think there's any catch-all (*) kind of way of doing it.

If that isn't what you want, then yes - you'll probably need to edit
the templates.

First off, you'll need to make FormFu use the TT templates, as it
doesn't by default.
    $form->render_method( 'tt' );
will do that.

You'll be customising the template files, so you want a local copy of
them, just for this application.
    html_formfu_deploy.pl DIRECTORY_NAME
will create the files at the given directory.
    $form->tt_args->{INCLUDE_PATH} = "DIRECTORY_NAME";
will tell FormFu where to find the templates.

You can try editing just the "field" template file.

Otherwise, look that the "*_filename" methods which can be overriden
to use different template files for specific elements or element types
(using default_args, as above).

> ALso i will like to wrap up just the label field with <span> tag
> Pl. reply , i need help urgently

This seems a bit redundant, as you should be able to just target the
label tag with CSS.
If you want to change the LABEL tag to a SPAN, you can use the same
default_args method as above to change the "label_tag" value.
If you really do want both a label and a span tag, then you'll
probably need to edit the "label template file.

Cheers,
Carl



More information about the HTML-FormFu mailing list