[html-formfu] Using HTML::FormFu and Template::Toolkit

Leanan Sidhe the.leanan.sidhe at gmail.com
Wed Feb 18 21:59:13 GMT 2009


Hello all.

My problem is that I can't for the life of me figure out how to use
Template::Toolkit and HTML::FormFu together as I would like.  I want to be
able to do something similar to what is mentioned here:
http://www.mail-archive.com/html-formfu@lists.scsys.co.uk/msg01010.html
I've a form that is split across multiple divs (I'm using the jquery tabs
plugin to tabify the form as it's rather large and unwieldly otherwise).
The form actually uses nested tabs.  I thought about trying to do:

elements:
  - type: Block
    tag: div
    content_xml: "lots of html here for setting up tabs"

but the problem is that I need to do something like the following:

<div id=3D"tabify_me">
  <ul>
    <li><a href=3D"#test1"><span>Test 1</span></a></li>
    <li>....</li>
  </ul>
  <div id=3D"test1"></div>
  <div id=3D"...."></div>
</div>

And some of the tabs have tabs as well, so repeat the chunk above for, say
within div test1.


The attempts I made to get things to nest did not work very well.  I tried
something along the following:

elements:
  - type: Block
    tag: div
    content_xml:"html for everything within div#tabify_me above"
    - type: Block
      tag: div
      content_xml:"html for stuff to go within div#test1"

FormFu didn't like that very much.

So then I started messing around with trying to use TT to render the
templates.  After some tinkering I tried something along the following:

elements:
  - name: testing
    render_method: tt
    filename: "Testing/testing_base.tt2"
  - type: Text
    name: something
  - type: Submit
    name: submit
    value: Submit

testing_base.tt2 loads a bunch of other templates together which create my
desired output.  And while I was hoping to not have to manually write out
the form in html, I'm ok with doing it this way.  The problem is that I
can't seem to get any of the data back from the form.  In my controller I
can do:

my $form =3D $c->stash->{form};
my $something =3D $form->param_value('something);

But I can't, for example, pull out my user name data that is defined in my
TT template (IE: <input id=3D"user_name" name=3D"user" type=3D"text" value=
=3D"[%
some_stash_variable %]">)

When I try to do my $name =3D $form->param_value('user'), it comes back as
undef.  I've pored over the various HTML::FormFu docs and examples, have
googled until I'm blue in the face and have looked back about 10 pages
through the archive.  Ideally I'd love to do the yaml as mentioned in the
other thread I found as I still need to add filtering and verification, but
I'd settle for what I have right now.  I just don't want to have to process
this monstrosity by hand if I can avoid it.  Any assistance, be it pointing
to specific parts of docs, examples, or fixing what I have (I know the code
I've provided is sparse) would be greatly appreciated, as I've been beating
my head against this for nearly two days now.

Thank you,
Leanan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20090218/cb=
6ff5e6/attachment.htm


More information about the HTML-FormFu mailing list