[html-formfu] formfu object in TT / accesing single formfu elements in TT

Carl Franks fireartist at gmail.com
Wed Feb 6 11:12:37 GMT 2008


On 06/02/2008, Benjamin Bellee <bellee at webit.de> wrote:
> well,
>
> i have another problem regarding the issue self.object.
>
> i need to acces (and render) single form elements, and i cant think of
> any other way then self.getelement(..)
> or anything similar.
> but i guess to be able to do so there has to be an object.
> is there any other way? or will there be an object someday?

That conversation was specific to making changes in formfu's own templates.

If you're wanting to grab elements and render them, you probably
shouldn't be customising formfu's own templates to do that - but
should be doing it within your own application's template files.

If that's the case, you still have access to the original HTML::FormFu object.
It's only convention to stringify it using [% form %], but you can
actually call any object methods you want to.

[% FOREACH field = form.get_fields %]
    [% field.render %]
[% END %]

See the files in "t/examples/" for some, uh, examples of that.
You can browse them here:
http://code.google.com/p/html-formfu/source/browse/trunk/HTML-FormFu/t/examples/

Carl



More information about the HTML-FormFu mailing list