[Html-widget] formfu - deflators

Daisuke Maki daisuke at endeworks.jp
Mon Apr 9 06:44:07 GMT 2007


Can you clarify for me how deflators are supposed to work?

My impression was that deflators are always run against a field during
render() time, if one is specified in the spec. For example,


  elements:
     -
        type: text
        name: foo
        inflator:
           - type: +MyCustom::Inflator
        defaltor:
           - type: +MyCustom::Deflator

So I want to receive some stuff in "foo" as text, but turn them into a
Perl object while I'm working with it -- then I want to call the
object's stringification method to turn it into a string again.

Looking at the code in HTML::FormFu::Element::input::_render_value, I see:

    if ( !$self->form->submitted ) {
        for my $deflator ( @{ $self->_deflators } ) {
            $value = $deflator->process($value);
        }
    }

which threw me off. So deflators aren't run if the form has been
submitted? Is this right?

--d



More information about the Html-widget mailing list