[html-formfu] Re: Quick FormFu Question

Moritz Onken onken at houseofdesign.de
Thu Feb 11 02:35:15 GMT 2010


On Wed, 10 Feb 2010 12:59:46 -0500, hkclark at gmail.com wrote:
> Hi Moritz,
> 
> I'm trying to make use of the very handy Label Element that you added
> a while back to FormFu.  Thanks for doing that.  A quick question if
> you don't mind: is there a way to have it not escape the content?
> Sort of like "content_xml" vs. "content" for block?
> 
> If not, do you know of a way to display some dynamic HTML markup (IOW,
> that comes from the DB from "HTML::FormFu::Model::DBIC") in a FormFu
> form?
> 
> PS -- I have wondered if it would be helpful to add to the Catalyst
> Tutorial FormFu example to get into more detailed and advanced stuff.
> Any chance you (or would you know of any other folks on the FormFu
> team) that might be interested in working together on such a thing?
> Thanks!

Hi Kennedy,

I totally see your point there. Unfortunately it isn't that easy to fix.
Every field has a value and value_xml method which contains the
field's value (default and default_xml are aliases for those methods).
Model::DBIC however sets the value by calling default.

I see two possible ways to fix this. Either we patch model::DBIC to read
a value from the model_config of a field and decide then whether to 
use default or default_xml:

---
  elements:
    - type: Label
      name: first
      model_config:
        is_xml: 1

Or for now you can write your own deflator which can reverse the encoding.
Have a look at HTML::FormFu::Deflator::FormatNumber for an example of
string manipulation.

The best practice for home-made Deflators is to name them like this:

HTML::FormFu::Deflator::MyApp::XMLLabel, so you can use

deflator:
  MyApp::XMLLabel

in the configuration.

I forwarded this mail to the formfu mailing list, which you should 
subscribe to :-)

I can find you on IRC next week so we can discuss about the Catalyst 
tutorial thing and what you have in mind.

Cheers,

moritz





More information about the HTML-FormFu mailing list