[html-formfu] Label element

Carl Franks fireartist at gmail.com
Fri Mar 20 11:26:52 GMT 2009


Moritz,

I see a Label element appeared in svn at some point! ;)
There's a few problems with it...

The tests fail when run with ENV var HTML_FORMFU_RENDER_METHOD=tt
This is because there's no TT template for it in share/templates/tt/xhtml

There should be a link to it from the HTML/Element.pm pod section
"OTHER CORE ELEMENTS"

Someone could still submit a name=value pair for it.
The model_config->{read_only} = 1 handles that for Model-DBIC, but it
could cause problems for other things.
I'm not sure it should really inherit from Element/_Field - though
dealing with that would be troublesome.
I'd suggest it should at least do something like:

    sub process_input {
        my ( $self, $input ) = @_;

        my $form = $self->form;
        my $name = $self->nested_name;

        if ( $form->submitted && $form->nested_hash_key_exists(
$input, $name ) ) {
            $form->delete_nested_hash_value( $input, $name );
        }

        return;
    }

These will need dealt with before Label.pm can be pushed to cpan.

I'd also prefer it if the test file followed the same conventions as others:
Have the form config in a separate config file - t/elements/label.yml
.t files shouldn't have a shbang line
and should use strict + warnings

Cheers,
Carl



More information about the HTML-FormFu mailing list