[Html-widget] formfu - deflators

Carl Franks fireartist at gmail.com
Wed Apr 25 11:47:17 GMT 2007

On 10/04/07, Daisuke Maki <daisuke at endeworks.jp> wrote:
> > The way they work at the moment, they´re intended to be run on values
> > you set yourself: $field->default($obj)
> > such as when you recieve a DateTime object from DBIx::Class.
> > When you redisplay a form, the original submitted value is used.
> > Filtered / inflated values aren´t used, so it shouldn´t prove a
> > problem that the deflators are only used when it´s not been submitted.
> > Of course, this is only how I think it should work - the code might
> > differ from my memory! I´m also open to suggestions on how it might
> > work better, as well.
> Thanks, I think I get the current status now.
> my perception was that
>     $form->process()
> runs Filters, Constraints, Inflators, and Validators and
>     $form->render()
> runs Deflators before outputting xhtml to produce values to be used for
> rendering.
> Basically what I wanted to do was
>    1. Receive an form
>    2. Inflate an element to an Object
>    3. Refer to, and change some values of the object
>    4. Deflate the object back to a string and see its
>       results in the form.
> For example, if I inflated a column to a DateTime object and then I
> changed the value to be a year ago the specified date (and perhaps
> explicitly set it as the value of that param), I was expecting the
> change to be visible when render() was called.
> I guess it's really the naming of the modules: there's an inflator, and
> a deflator, I expected one to compliment the other. So if inflators
> always run, then deflators always do too, or something like that.
> I don't have too strong of an opinion as to whether this should be
> changed to not -- I just thought that was a natural sequence of events.

I'd forgotten that there was a render_processed_value() method which
ensures the processed value is displayed to the user. (I was on
holiday when I initially replied!)
I agree that if render_processed_value() is true, the values should
also be run through the Deflators.
I've added a task to the issue tracker for this.


More information about the Html-widget mailing list