Hi,

Still trying to figure out how to handle variables passed to
a template.
ll
The formBuilder plugin which I use along with TT and catalyst
create an array of hashes ( as I can see) and this is saved into the stash.

In the template I can acces this with:

[% field = FormBuilder.field %]
[% FOREACH item IN field %]
        [% item.name %]
      [% item.label %]
        [% item.value %]
        .......

but to access a specific field I have to know which index in the ARRAY to use.

In trying to gain more control I have tried:

[% PERL %]
        my $fields = $stash->get('field');
        # This returns a REF to an array. When I do:
        foreach my $item ( @$fields) {
                print "$item";
        }
        # I just get the name of the fields. I would have expected a HASH
        # not just a string
[% END %]


Furthermore I thought that I could do the following:

[% field = FormBuilder.field %]
[% FOREACH item IN field %]
        [% field2hash.name  = item.name %]
      [% field2hash.name.label = item.label %]
        [% field2hash.name.value = item.value %]
        .......


But the only assigned value is [% field2hash.name %]

I can't use field2hash.name.label NOTATION. Probably because I'm quite new into 
this
Can someone help?

Regards
Peter Sorensen/University of Southern Denmark/email: [EMAIL PROTECTED]

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to